2008.02.27 20:33 "[Tiff] Printing TIff images", by Richard Nolde
Regarding printing TIFF images:
I'm new to libtiff and image manipulation for that matter and was wondering how folks are sending tiff images for print in a UNIX environment (lpr). I realize there is a requirement from text to postscript which can be provided by associated printcap filter designations. Oh.. I'm looking at doing this via command line as I need to script a process for this.
Not surprisingly I use GraphicsMagick to do this. ;-)
gm convert file.tiff -rotate 90 -page Letter PS:- | lp -c -d myprinter
There are other possibilities as well depending on the size and nature of your images. Tiff2ps has numerous options for arranging the image on the page including rotating, centering, etc. I submitted some patches that may or may not have ever made it into the libtiff distribution to provide an "auto" option for the rotate flag and added 90 and 270 degrees as other options. Auto will position the image on the page such that the longest side of the image will match the longest side of the page specified with the -h and -w flags. You can also chop a large image into multiple pages of the size specified with -h and -w.
Tiffcrop carries this one step farther and allows you to specify a PAPER size eg letter, legal instead of a width or height or to use the width and height options. It also allows you to add a margin when dividing large images into separate sheets but it does not rescale the data so your target sheet size must allow enough room for the margin or the image will span an extra page. Since tiffcrop does not yet support direct output to Postscript, you would have to use tiff2ps afterwards before sending to the printer. The advantage of the two step process for reimaging large sheets is that tiff2ps uses the Postscript masking operation to show only the portion of the image that fits on the target page size but includes the full sized image on each page of output. Tiffcrop creates multiple pages, each with ONLY the data for that page.
If you are printing large arcitectural drawings that are 36" x 48" on a legal size page, you would need 12 sheets to print the image. With tiff2ps, you would be sending the full resolution image to the printer 12 times and throwing most of the data away each time. With preprocessing with tiffcrop, you would send no more than 1/12 of the data each time. I'd like to add the logic to produce Postscript into tiffcrop but I haven't had the time.
If you have images in a variety of sizes and want to print them on different media based on the size, you can parse the output of tiffinfo and calculate the largest and/or smallest page sizes required and translate that into letter, legal, etc which might be of use if the resolution of the images does not match the resolution at which you want to print them. I have an awk script that does this if you are interested.
> This is great to know. While I have downloaded/installed libtiff > (tiff-3.8.2.zip) on my UNIX server, I do not have tiffcrop installed as one
> of the utilities.How can I configure/install this. Configure/make didn't > create this. I'm no developer, so need a bit of help if possible in getting
> this set-up.