Thursday, November 22, 2012

Converting jpeg to pdf with lower quality

Convert jpeg into PDF with 50% quality:

$ convert -quality 50 file1.jpg file.pdf


Combine multiple file into PDf

$ pdftk *.pdf cat output merged.pdf
or
$ pdftk file1.pdf file2.pdf cat output merged.pdf

You need to have imagemagick and pdftk installed on your system.

If you have multiple files to convert, use the following command on bash:


$ for i in *.jpg; do convert -quality 50 -resize 60% "$i" "${i%.jpg}.eps"; done


Changing resolutions in DPI

$ convert -units PixelPerInch pic1.png -density 300 pic1.jpg
$ identify -verbose pic1.jpg | grep Resolution
Resolution: 300x300

No comments: