Convert jpeg to pdf in Ubuntu 9.04

From Cosmin's Wiki

Jump to: navigation, search

Home > Linux Desktop tips > Convert jpeg to pdf in Ubuntu 9.04

After having installed your scanner, you have started to scan away. As I usually do not send (by email for example) scanned files as .jpg or .jpeg because I'm never sure how others will receive or print them, I have the habit of converting them into pdf files. This is how to do this in Ubuntu 9.04:

First, install the ImageMagick:

> aptitude install imagemagick

Normally, the conversion process goes like this (in a terminal window):

> convert -page A4 your_image.jpg output.pdf

however you will notice that the size of the pdf file is quite huge. This is due to the fact that the default behavior if ImageMagick is to uncompress the .jpg file and store it in lossless format. To get over this, just specify as an argument the compression to use (i.e. to recompress the image):

> convert -page A4 -compress jpeg your_image.jpg output.pdf

which will give you the expected result.