Page 1 of 1

Append to Multi-Page Image

Posted: 2009-09-05T07:19:37-07:00
by CosminU
Greetings,

I need to programatically append to a multi-page TIFF or PDF a new image. The problem is that the individual images (that compose the multi-page one) have large resolutions and ImageMagick first loads the entire multi-page image into memory, which takes all the system's memory.

I need to be able to append to a multi-page image without having to load the entire image into memory. Is this possible with ImageMagick? Which C\C++ functions should I use?

Regards,
Cosmin

Re: Append to Multi-Page Image

Posted: 2009-09-05T09:43:51-07:00
by fmw42
I don't recommend using IM for such a task with PDF. As I understand it, IM converts vector formats such as PDF to raster and then back to vector for PDF. So there will be a loss in quality. see http://www.imagemagick.org/Usage/formats/#vector

Appending to tiff is possible, but I doubt without reading all the pages first. But I will defer to the IM experts.

IM tiff documentation is at http://www.imagemagick.org/Usage/formats/#tiff

Re: Append to Multi-Page Image

Posted: 2009-09-08T23:53:09-07:00
by anthony
IM can not append to an existing image file format.
All it can do is read the format into memory, add the image and write it out again.
This generally works, but not always successfully. unfortunateally it will break down on very long files which can not all be loaded into memory all at the same time. Video Formats for example.

For true appending to an existing image file format you will need to look for a tool specific to the image file format that is involved.

Some formats can be just simply appended. The NetPBM file formats for example, allows you to do this, or the IM internal format MIFF. I do not however think TIFF can do this, so some special 'add image to existing file' must be used.

Re: Append to Multi-Page Image

Posted: 2009-09-09T04:38:26-07:00
by CosminU
Thank you for your answers! Greatly appreciated.

Regards,
Cosmin