Home

Fri, May. 2nd, 2008, 01:17 am
Converting multiple TIFFs to one small PDF

OK. So I just spent the last two hours trying to figure this ImageMagick program out. I wanted it to do, relatively, the same thing that Gimp could do with the results being similar.

Problem: I wanted to convert a bunch of TIFF files from our office copier/scanner (one tiff per page) into a self contained PDF.
Complication: Using the straight through no options command "convert" from ImageMagick would produce really REALLY large PDF's - when it wouldn't crash from running out of memory.
Requirement: It needed to be about 200 - 400k MAX and print out at the original size.

So, I tried all of these options with image magick, and a lot of the time, I could "resize" the image, and it looks fine in EOG or The GIMP, but when I would write it out to ps or pdf it would produce an 8.5x11 page, but with the scanned image taking up 1/32 to 1/4 of the page.
The following commands pretty much give me 200k - 500k sizes. The quality of the image (as you would expect) go from decent to pretty good. Since this is just a way of scanning paperwork, converting them to 1bit PDF would do too. The input files were 591k for page1.tif, and 237k for page2.tif with an original resolution of 600x600dpi.
Reduce the resolution to 200dpi, and resize it to 25%, THEN before spitting it out as a Postscript file, increase it back to its original 'print' size
convert page[12].tif \( -colorspace gray \) \( -resample 200x200 \) \( -resize 1275x1650 \) \( -resize 1700x2200 \) step3c.ps
ps2pdf step3c.ps
You can leave out the middle "resizes" but my file size jumped at that point way too much. Leaving out the middle resize, and my file size went from 270k to 355k. Leaving out both resizes it was still at 355k, but the image quality was poorer.
ps2pdf I noticed produced the smallest file size. In fact, using the built in ps2pdf the file size was twice as much!

Tue, Apr. 29th, 2008, 12:34 pm
TIFF to PDF

So there's this new copier at work which can also scan documents. The documents it produces are in TIFF format (one per page scanned). Typically, I would want to get them into a format suitable for PDF'ing. The problem is that I hadn't figured out how to get multiple TIFF files into one file. There might be an easier way, but here goes.
  1. download the TIFF
  2. open it in the GIMP
  3. Convert it to greyscale (or truecolor)
  4. Scale it down to 25% of the original size, set the DPI to 200
  5. Zoom to 100%
  6. Save as... filename.ps (postscript)
  7. In the dialog box that comes up, set the image size to 8.5x11, change the X and Y offset to 0.
  8. Rinse and repeat for each TIFF file
  9. cat each file in page order to a new file (cat *.ps > new_file.ps)
  10. Run ps2pdf on the new_file.ps
Now if I could only use ImageMagick to manipulate the TIFF file, then I could script the whole thing.