Imagemagick

From Dave's wiki
Jump to navigation Jump to search

To install

sudo apt-get install imagemagick

Format change

convert original.png converted.pdf
convert -density 96 -quality 85 original.png converted.pdf

# set background colour
convert -density 96 -quality 85 -background "#FFFFFF" -flatten original.png converted.pdf

Resizing

convert dragon.gif -resize 64x64 resize_dragon.gif
convert dragon.gif -resize 50% half_dragon.gif

Transparent

convert input.gif -transparent white output.gif

Remove whitespace

# http://www.imagemagick.org/script/command-line-options.php#trim
convert -trim blah.png trimmed.png

2 by 2

convert \( image1 image2 -append \) \
\( image3 image4 -append \) +append result