Page 1 of 1

Combine many large tiffs to one pdf (or ps) file

Posted: 2009-03-16T13:20:06-07:00
by mgcleveland
I'm trying to combine many (100s) of large (10MB+) tiff files into one pdf or ps file but every attempt results in failure due to overuse of system resources (I suspect). The command I'm running is (in a perl script):

convert -compress JPEG -adjoin @formatted_files $dir_name/$pdf_file

where "@formatted_files" is a list of all the files to be converted, "$dir_name" is the directory for output (this perl script would ideally batch process many directories), and "$pdf_file" is the pdf file to be written.

This works on directories containg lesser numbers of images with smaller file sizes, but any moderately sized input inevitably results in failure. I've tried using the "limit memory" and "limit map" options with no success. Maybe I'm using those incorrectly. Does anyone have an idea of a workaround for this problem? Thanks for all your help!

System - RedHat 4, 6 Gb mem, 4x Intel Xeon 3.2 GHz processors

Re: Combine many large tiffs to one pdf (or ps) file

Posted: 2009-03-16T14:01:44-07:00
by magick
Go disk? If so, ImageMagick can process as many images as you have disk space. Assume you have 1TB of free space at /data. This command should work:
  • export MAGICK_TMPDIR=/data
    convert -limit area 1 -compress JPEG -adjoin @formatted_files $dir_name/$pdf_file
This should force all pixels to disk and allow the process to finish without complaint. If not you can resize each image in-place so it consumes less resources (assumes a modern version of ImageMagick). Here's an example:
  • convert -limit area 1 'image-*.tif[512x512]' image.pdf

Re: Combine many large tiffs to one pdf (or ps) file

Posted: 2009-03-17T10:50:55-07:00
by mgcleveland
Hi Magick, thanks for your response.

That approach doesn't seem to be working. I'm monitoring both memory usage and disk usage during the process and memory is still being completely monopolized while disk is not used at all.