I have a simple problem. I have multipage pdf files that I need to convert to a single page long, vertical tiff file. I successfully do this easily but while doing so, the image degrades an unacceptable amount no matter what I do.
convert "file1.pdf" -append "file1.tif"
Any help would be appreciated.
I can send an example file...
thanks in advance.
append without degradation
-
- Posts: 4
- Joined: 2012-09-05T10:57:56-07:00
- Authentication code: 67789
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: append without degradation
You have to set the resolution before reading the PDF. Furthermore you should set some compression format in order to reduce the size of the output file. So your command should be something along the lines of:
convert -density 254 test.pdf -append -compress zip test.tif
convert -density 254 test.pdf -append -compress zip test.tif
Wolfgang Hugemann
-
- Posts: 4
- Joined: 2012-09-05T10:57:56-07:00
- Authentication code: 67789
Re: append without degradation
Wolfgang,
That worked. Now can I batch process about 30 of these files? Each are pdf's that are named differently and all in one directory.
Thanks a million. I owe you lunch...
That worked. Now can I batch process about 30 of these files? Each are pdf's that are named differently and all in one directory.
Thanks a million. I owe you lunch...
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: append without degradation
You could either use Mogrify instead of Convert with a filename template or loop through the files by a script or OS command. How exactly you perform the latter depends on you operating system, which you didn't tell. Examples under Windows can be found at the link below.
Wolfgang Hugemann
-
- Posts: 4
- Joined: 2012-09-05T10:57:56-07:00
- Authentication code: 67789
Re: append without degradation
Dear Wolfgang,
Here is my script:
montage -density 254 "Bankers Black Sonic Log.pdf" -mode concatenate -tile 1 "Bankers Black Sonic Log.tif"
or
convert -density 254 "Apollo Watson D-N Log.pdf" -append "Apollo Watson D-N Log.tif"
Each original file is 12-15 MB. I watched system resources and the Ram used exceeded 1.6GB. The process brings my win32 with 3GB Ram to its knees. I have 4 I7 dual processors running at 2.67 GHz. (Gateway). The CPU varies from 1-12% staying mostly low. It is also heavily using I/O.
I can't wait this long for each file to complete. Is there a less intensive way to do this. This is not a complicated process. I am just stiching images together.
I can send you one of the files to give it a try...
Thanks in advance,
Dan
Here is my script:
montage -density 254 "Bankers Black Sonic Log.pdf" -mode concatenate -tile 1 "Bankers Black Sonic Log.tif"
or
convert -density 254 "Apollo Watson D-N Log.pdf" -append "Apollo Watson D-N Log.tif"
Each original file is 12-15 MB. I watched system resources and the Ram used exceeded 1.6GB. The process brings my win32 with 3GB Ram to its knees. I have 4 I7 dual processors running at 2.67 GHz. (Gateway). The CPU varies from 1-12% staying mostly low. It is also heavily using I/O.
I can't wait this long for each file to complete. Is there a less intensive way to do this. This is not a complicated process. I am just stiching images together.
I can send you one of the files to give it a try...
Thanks in advance,
Dan
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: append without degradation
You must remember IM when handling PDF files is calling another program to do this very complex task .. Ghostscript
You can try and use ghost script directly, which will avoid a lot of extra file handling IM has to do due to security concerns. See Using GhostScript Directly
http://www.imagemagick.org/Usage/text/#ghostscript
Ghostscript can output directly to TIFF file format, though to append you can still feed IM.
The ideal soltuion would be to get ghostscript to output a stream of images (ppm format), then have IM read and append the stream (pipeline) and output the final result. this will avoid all the intermediate disk I/O, that would have been slowing your previous usage.
Something like (psuedo-code)
This technique is used in an number of IM example (though not with ghostscript).
For a simple example using MIFF image stream, rather than PPM...
http://www.imagemagick.org/Usage/files/#miff_stream
You can try and use ghost script directly, which will avoid a lot of extra file handling IM has to do due to security concerns. See Using GhostScript Directly
http://www.imagemagick.org/Usage/text/#ghostscript
Ghostscript can output directly to TIFF file format, though to append you can still feed IM.
The ideal soltuion would be to get ghostscript to output a stream of images (ppm format), then have IM read and append the stream (pipeline) and output the final result. this will avoid all the intermediate disk I/O, that would have been slowing your previous usage.
Something like (psuedo-code)
Code: Select all
for each image
ghostscript image, output PPM images to stdout
end | convert ppm:- +append final.tif
For a simple example using MIFF image stream, rather than PPM...
http://www.imagemagick.org/Usage/files/#miff_stream
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/