converting jpeg files to pdf

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
clayton

converting jpeg files to pdf

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: converting jpeg files to pdf

Post by fmw42 »

not really an expert on this, but see

http://www.imagemagick.org/Usage/formats/#pdf under Postscript/PDF Output Options
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting jpeg files to pdf

Post 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
snibgo's IM pages: im.snibgo.com
clayton

Re: converting jpeg files to pdf

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting jpeg files to pdf

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: converting jpeg files to pdf

Post by fmw42 »

clayton

Re: converting jpeg files to pdf

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