Page 1 of 1

converting jpeg files to pdf

Posted: 2010-02-11T20:51:34-07:00
by clayton
I am trying to convert 30 jpeg files to a pdf. The resulting pdf is much larger (10 to 30 times) than I would expect. The original images are about 100k each. Since I want to distribute the pdf by email, I would like it to be a reasonable size. Notice the segmentation fault when I neglect to add the "+convert" option.

Code: Select all

> convert *jpg my.pdf
Segmentation fault
> convert *jpg +compress my.pdf
> ls -l my.pdf
-rw-r--r-- 1 clayton clayton 119523461 2010-02-11 22:40 my.pdf
> convert *jpg -compress zip my.pdf
> ls -l my.pdf
-rw-r--r-- 1 clayton clayton 34094669 2010-02-11 22:41 my.pdf
> convert --version
Version: ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Re: converting jpeg files to pdf

Posted: 2010-02-11T21:09:30-07:00
by fmw42
not really an expert on this, but see

http://www.imagemagick.org/Usage/formats/#pdf under Postscript/PDF Output Options

Re: converting jpeg files to pdf

Posted: 2010-02-11T21:31:53-07:00
by snibgo
I know nothing about PDF, but you might try:

Code: Select all

convert *jpg -compress JPEG my.pdf
ls -l my.pdf
convert *jpg -compress JPEG -quality 50 my.pdf
ls -l my.pdf

Re: converting jpeg files to pdf

Posted: 2010-02-11T21:38:58-07:00
by clayton
Thanks so much for the quick replies.

-compress JPEG results in a segmentation fault. The monochrome option makes the pdf much smaller but destroys the image quality. Otherwise the options suggested in the pdf output option documentation pointed to by the first reply do not help. I'm thinking of converting my images to greyscale and trying again, though that would be a shame.

Re: converting jpeg files to pdf

Posted: 2010-02-11T22:00:36-07:00
by snibgo
Don't forget that IM will try to read in all the JPEGS and decompress them before doing the processing. How many pixels does each one have?

You might look at the problem differently. You don't really want to ocnvert the images. Instead, you want to include them (unconverted) in a PDF documnent. For that, you might use OpenOffice.org to create a document and include the images. Then export the PDF. (Maybe OpenOffice won't convert the files if you leave the "compression" unchanged.)

If you need to do this multiple times, you could write an OpenOffice macro.

Re: converting jpeg files to pdf

Posted: 2010-02-11T22:38:34-07:00
by fmw42

Re: converting jpeg files to pdf

Posted: 2010-02-13T14:26:10-07:00
by clayton
Thanks again to both of you for your suggestions. I understand the issue much better now. I did finally use Open Office, and that produced a PDF of not much more than the size of the images.

Thanks!