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
Append to Multi-Page Image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Append to Multi-Page Image
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
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Append to Multi-Page Image
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Append to Multi-Page Image
Thank you for your answers! Greatly appreciated.
Regards,
Cosmin
Regards,
Cosmin