ImageMagick is a powerful tool for manipulating and resizing images, we can use cli, oneliners to achieve time consuming tasks with this tool.
1. Resize the Image
-resize
flag is very useful for resizing width or height of a image.
convert input.jpg -resize 800x600 output.jpg
2. Compress the image
To reduce size of larger e.g 4k images we could use -quality
to compress the image.
convert input.jpg -quality 80 output.jpg
3. Strip Unnecessary Metadata
Sometime Image size can be further reduced if unwanted metadata is stripped with -strip
option
convert input.jpg -strip output.jpg
4. Use -thumbnail
option
To create quick thumbnail outof any image this could be handy.
convert input.jpg -thumbnail 200x200 output.jpg
5. Use identify
command
The identify
command is used to identify the format and characteristics of an image. For example:
identify -format "%[fx:w*h]" input.jpg
This will output the width and height of the input image.