ImageMagick
ImageMagick is a command-line tool for processing image files.
This tool is not suitable for processing RAW images; darktable is recommended instead.
Install
environment | command |
---|---|
archlinux | pacman -S imagemagick |
mingw-w64 | pacman -S mingw-w64-i686-imagemagick |
brew on mac | brew install imagemagick |
additional libraries
Please note that you must also install libraries to handle specific image formats.
format | required library |
---|---|
webp | libwebp |
Command
convert
convert src.png [options] dst.jpg # output format is recognized by an extension
option | target format | description |
---|---|---|
-auto-orient | * | Rotates the raw image according to the metadata orientation, and removes the orientation tag. |
-resize X% | * | Resize the image by the specified percentage. |
-strip | * | Removes any metadata. |
-define webp:method=N | webp | Quality of webp format(1~6). A higher value results in stronger compression and lower quality. |
Command Examples
Compress into webp for blogs
convert $i -define webp:method=6 -resize 15% -auto-orient -strip ${i%.jpg}.webp