Thursday, June 7, 2012

Converting images

To convert images from a folder to a single pdf:

open terminal in that folder and run like:


convert *.jpg my_new.pdf

or

convert *.png my_newpng.pdf


General formula:

convert *.extensiontype file.pdf

or

convert imagename.extensiontype file.pdf


To reduce the size by 50%:


convert -resize 50% source.png dest.jpg
or
convert -resize 50% source.jpg dest.jpg
or even smth like:

convert -resize 1024X768 source.png dest.jpg

where you can replace extensions accordingly



Using ImageMagick to convert images:

sudo apt-get install imagemagick
mogrify -resize 50% *png # keep image aspect ratio
mogrify -resize 320x240 *png # keep image aspect ratio
mogrify -resize 320x240! *png # don't keep image aspect ratio
mogrify -resize 800x1094! *jpg # don't keep image aspect ratio

Keeping aspect ratio:
mogrify -resize x240 *png

mogrify -resize 320x *png

mogrify -resize 50% *jpg # keep image aspect ratio

About ImageMagick here and here.

No comments:

Post a Comment