0

ImageMagick is a software that allows to edit almost all available formats via the command line. You can also use it to automate certain editing actions (Resizing, converting, etc.) on several images placed in a folder.

To install ImageMagick on Ubuntu (11.04/10.10/10.04), launch the terminal and issue this command:

sudo apt-get install imagemagick

Here are some examples of the actions you can do with ImageMagick via the terminal:


1. To convert , for example, JPG to PNG, run this command:

convert image.jpg image.png

2. To convert JPG to PNG by indicating the image resolution, run this command:

convert -quality 72 image.jpg image.png

Replace 72 with any other number (96, 150, 300, etc.). These numbers are expressed in DPI (Dots per inch).

3. To obtain info about an image, run simply this command:

identify -ping image.jpg

4. For more image info, you can use this command:

identify -verbose image.jpg

5. To know all colors used in an image, issue this command:

identify -list color image.jpg

6. To convert all JPG files into PNG files that are placed in a folder, simply use this command:

mogrify -quality 150 -format png *.jpg

7. If you want to convert your images (mixed formats) into PDF, use this command:

convert images*.* file.pdf

8. To resize an image, issue this command:

convert -resize 100×100 input.png otput-resized.png

9. To create a favicon via the terminal, use this command:

convert -colors 256 -resize 32×32 image.png favicon.ico

10. To convert a colored image to a black and white image, run this command:

convert -type image.png black-and-white.png

11. To add a transparent border to an image, use this command:

convert -bordercolor Transparent -border 3 image.jpg border-image.png

For a colored border, use this command:

convert -bordercolor red -border 3 image.jpg border-image.png

Replace 'red' with any other color of your choice (yellow, green, CSS color (#000000), etc.).

12. To negate an image, run this command:

convert -negate image.jpg negated-image.jpg

14. To flip an image by 90 degrees, run this command:

convert -flip image.jpg flipped-image.png

15. If you want to edit your image using the GUI of ImageMagick, run simply this command:

display image.jpg

Post a Comment

 
Top