Convert image with ImageMagick in command line

ImageMagick is an open source software suite for displaying, converting, and editing raster image files. It can read and write over 100 image file formats. ImageMagick is licensed under the ImageMagick License, a BSD-style license.

Let give some example how to use tool from the commands line

Convert a image PNG to JPEG en giving rate of the compression :

convert -quality 96 image.png image.jpg

Convert in the same folder all images PNG to JPEG :

mogrify -format png *.jpg

Convert all images (jpg, png…) to PDF :

convert images*.* file.pdf

Resize the size of an image :

convert -resize 48×48 image.png image-mini.png

Resize the size of all images in a folder :

mogrify -resize 48×48 *.png

Resizing an image showing only the width :

convert -resize 620x image.png image-620.png
Resizing an image showing only the height:

convert -resize x100 image.png image-100.png

Create a icon :

convert -colors 256 -resize 16×16 image.jpg favicon.ico

Convert a color image into black and white :

convert -type image.jpg image-noir-blanc.jpg

Add a border of 1 pixel transparent around an image :

convert -bordercolor Transparent -border 1×1 image.png image-bordure.png

Add a black border of 10 pixels around an image:

convert -bordercolor #000000 -border 10×10 image.png image-bordure.png

Making a negative of a image :

convert -negate image.png image-negate.png

Return an image from bottom to top :

convert -flip image.png image-inversee.png

Return an image from left to right :

convert -flop image.png image-inversee.png
Use ImageMagick GUI :

display image.png