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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mgcleveland

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

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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
mgcleveland

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

Post 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.
Post Reply