Convert jpeg files to PDF under Linux
How to convert jpg files to one PDF?
- Requirements:
- Linux
Ubuntu is my favorite. But you can use any other distribution.
- ImageMagick
Type the follow line to Ubuntu commmand prompt for intall ImageMagick:
sudo apt-get install imagemagick
- Convert from jpegs to PDF:
- Go to the work directory (directory of jpegs):
cd work/directory/path - Convert the JPG files to PDF:
convert *.jpg foo.pdf
So easy, not?
Leave a comment if you can or can't convert your files?
Have you same problem in Windows? Download the PDFCreator. PDFCreator is a free tool to create PDF files from nearly any Windows application that is able to print. (Not just JPG)
Another solution in Linux:
Any KDE application can print in PDF file (same method as PDFCreator). Select JPG-s and print in PDF.







Thank you so much!
- reply
Submitted by Rmitboy (not verified) on March 21, 2010 - 6:12pm.Doesn't work for me. It says "segmentation error" after a long while... Is there a limit for the number of pictures to put ?
- reply
Submitted by max (not verified) on March 3, 2010 - 12:54am.I should mention that the pdfjam solution is far more efficient than imagemagick, it seems. The former took my 69MB of files and gave me a 71MB PDF, while the latter gave me a 445MB (!) PDF.
- reply
Submitted by gwern (not verified) on February 19, 2010 - 4:46pm.Hi
I tried that with the command line but every time my pdf is corrupt or damaged. If i convert one jpg file is ok if i convert multiple jpgs to a pdf file it gives me the damaged pdf file.
could you send me a replay to my email?
best regards
Sani
- reply
Submitted by Sani (not verified) on January 30, 2010 - 2:01pm.Just magic. 'Have been working on Linux (Xubuntu) for over 2 years now, no looking back...
Thank you so much for sharing!
- reply
Submitted by Fred (not verified) on January 15, 2010 - 8:58pm.Yes, this is a goal.
Thahks!
- reply
Submitted by Vladimir (not verified) on December 30, 2009 - 9:56am.That is awesome!
Thank you mate!
- reply
Submitted by Visitor (not verified) on December 13, 2009 - 11:33pm.Thanks a lot.
It worked like magic.
- reply
Submitted by AJEDE (not verified) on November 24, 2009 - 8:03pm.Hi Thomas,
First of all thank you very much for mentioning about this tool.
I installed it and converted a bunch of files. All went smooth.
But the size of the pdf files generated were huge. This tool has a "compress" option but I don't know what value to pass.
So, I tried the suggestion (given in one of the comments) to use F-Spot and it worked sweetly.
And I managed to add 10 jpg files to F-Spot and select them all, click print, and chose the option to print to a pdf file.
Done. My jpg files were converted and that too with much less size.
Thanks anyway for everyone who gave your valuable thoughts.
- reply
Submitted by James (not verified) on November 12, 2009 - 6:58am.Thanks a lot. Everything works fine!
- reply
Submitted by Visitor (not verified) on October 17, 2009 - 9:52pm.I'm new in linux. I've tried to convert *.jpg files into pdf and it worked...
- reply
Submitted by CAML (not verified) on July 4, 2009 - 11:35pm.These command convert *.JPG wathever.pdf works perfectly!!
Thanxxx!!!
- reply
Submitted by Al (not verified) on August 31, 2009 - 6:41pm.first, let us change the name of the jpgs to pdf:
prename 's/\.jpg$/\.pdf/' *.jpg
then, join them with pdfjoin:
pdfjoin *.pdf
Done :)
- reply
Submitted by Lior Zimmerman (not verified) on June 20, 2009 - 11:45am.Converting more than a few images can be a little tricky using only the command line. To batch convert them, use F-Spot.
1. Open F-Spot.
2. Add the images you want to convert, they must be in the order you want them.
3. Click print, and select "Print to file"
Your output will be the PDF file.
- reply
Submitted by Firefly (not verified) on April 13, 2009 - 9:41pm.Or you could simply do this: for x in *.jpg; do convert $x `basename $x jpg`pdf; done
- reply
Submitted by Trond (not verified) on August 26, 2009 - 11:30am.I tried to run this on 40 jpeg pages, and ran out of memory, had to add another 500MB of swap,
most of the images were at 300 dpi, vmsize went past 2.2GB
- reply
Submitted by mpcoc (not verified) on February 13, 2009 - 5:37pm.If you want to convert single file:
convert 000.jpg 000.pdf
But if you want to convert multiple jpgs to one PDF you have to add -adjoin param:
convert *.jpg -adjoin 000.pdf
It works on mine Ubuntu and it's what manual says about converting few images into multiimage PDF.
- reply
Submitted by Lukasz Rybka (not verified) on February 4, 2009 - 1:59pm.If there are text (as images) in jpeg does ImageMagick convert those to characters?
- reply
Submitted by Visitor (not verified) on January 29, 2009 - 1:04am.No, it doesn't convert those to characters.
- reply
Submitted by Thomas on February 20, 2009 - 10:40pm.I tried to run this on 40 jpeg pages, and ran out of memory, had to add another 500MB of swap,
most of the images were at 300 dpi, vmsize went past 2.2GB
Allen
- reply
Submitted by allen (not verified) on December 15, 2008 - 12:37am.Yes, you need to add more swap if you haven't got enough memory. The convertion will be slower with swap, but convert process does not ran out of memory.
Thx your comment.
- reply
Submitted by Thomas on December 16, 2008 - 12:37am.thanks. it works the way I expected. :D
- reply
Submitted by Ronah (not verified) on November 13, 2008 - 12:44pm.doesn't work for me, says it fails to find the file/directory...
i m doing something wrong, am i?
- reply
Submitted by Visitor (not verified) on October 9, 2008 - 11:12am.Hello,
Check your filenames. All file and directory name is case sensitive in linux. Check your command and modify it from *.jpg to *.JPG or something other correct extension.
- reply
Submitted by Thomas on October 17, 2008 - 10:25am.It works...great. I was in the wrong directory the first time.
- reply
Submitted by matt (not verified) on August 27, 2008 - 8:35pm.This doesn't work for me with the wild card, if I do convert *.jpg foo.pdf, I get "can't find *.jpg" I'm using ubuntu.
thanks
mbs
- reply
Submitted by matt (not verified) on August 27, 2008 - 8:32pm.I got the same message first try. Remember - case sensitive so try *.JPG
- reply
Submitted by Visitor (not verified) on September 1, 2008 - 6:45am.Thank you, it works!!!
--> Mandriva 2008 One spring
Add the following lines to your KDE file:
vi .kde/share/apps/konqueror/servicemenus/PDF_merge_images_to_pdf.desktop
[Desktop Entry]
ServiceTypes=image/*
Actions=setAsPdf
[Desktop Action setAsPdf]
Name=Convertir a PDF
Icon=pdf
Exec=convert %U foo.pdf
- reply
Submitted by JuanV (not verified) on July 23, 2008 - 11:04pm.Just what I needed. Thanks!
- reply
Submitted by Alex (not verified) on July 17, 2008 - 4:13am.Works like a treat!
- reply
Submitted by Stefan (not verified) on July 6, 2008 - 7:08pm.Works perfectly. Really sweet. Thanks.
- reply
Submitted by Visitor (not verified) on March 27, 2008 - 8:59am.Thanks a lot. It really worked suberb.
- reply
Submitted by Visitor (not verified) on December 17, 2009 - 12:25am.Post new comment