Ceci est une ancienne révision du document !
Fear not Blender fans – Nicholas will return next month. Well, assuming his employer will actually give him a day off and some free time that is…
It's a common enough task, trying to convert multiple jpg files into one pdf, particularly when I don't need these to be converted with such high quality, I just want the black and white text readable.
I can scan, crop, and monochrome in a graphics program, but compiling them into a single PDF booklet was always tricky. Which is how I started using ImageMagick.
Je peux numériser, recadrer, mettre en noir et blanc à l'aide d'un logiciel de retouche d'images mais mettre toutes les images dans un seul fichier PDF est difficile. Voilà pourquoi j'ai commencé à utiliser ImageMagick.
ImageMagick is a command-line conversion program that is capable of so many more batch operations than this - resizing, compression, format conversion - and it's available on all platforms - Linux, Windows and Mac.
ImageMagick est un programme de convention en ligne de commande qui est capable de faire du traitement par lot de retaillage, de compression ou de conversion de format et il est disponible sur toutes les plateformes linux, windows et Macosx.
Bear in mind that creating a PDF document from multiple JPEG images can take some time, and you may want to trial different settings for size and quality of output, so I suggest you make a copy of the JPEG files in a temporary folder to play around with and use Imagemagick on those – NOT on your originals. Reducing the resolution as a first step will also make things much quicker.
Originally I was just using the basic:
convert *.jpg output.pdf and/or convert *.jpg -adjoin output.pdf
which works most of the time. However, there's a bug in the convert routine which can in some versions give a segmentation fault when converting a number of JPEG files to one PDF file.
What this command does is take all the .jpg's (or format of your choice) in a folder, and convert them to a single PDF - you can name it whatever you like.
You can avoid the segmentation fault bug and do the compression at the same time if you use: convert *.JPG -compress Zip output.pdf
but the zip compression appears quite inefficient and results in huge file sizes.
You could resize and lower the quality of the images using:
mogrify -resize 50% -quality 25
Which overwrites the originals. You can combine resizing and conversion using:
convert -quality 25 -resize 50% *.jpg -adjoin output.pdf
which works, but takes longer as you're combining batch operations.
And yes, you can resizing images without overwriting the originals by specifying a new file name:
convert '*.JPG' -resize 640×480 newfile%03d.jpg
which outputs the converted images as newfile001.jpg, newfile002.jpg, and so on. Alternatively, if you want to retain the original filename and prepend “new”, you could use a bit more code:
for file in *.JPG ; do convert “$file” -resize 640×480 “new-${file}” ; done
This is just a sample of what Imagemagick can do if you are prepared to experiment at the command-line.