Skip to content

ImageMagick

Info

What Where
Official Page https://imagemagick.org
Source https://github.com/imagemagick/imagemagick
Download https://imagemagick.org/script/download.php
Install sudo apt install imagemagick or choco install imagemagick
Examples https://imagemagick.org/script/examples.php or https://imagemagick.org/script/

GIF

Use ImageMagick to optimize a GIF

convert -layers Optimize input.gif output.gif

Resize

convert file.jpg -resize 1024 × 768 "folder\file.jpg"

Diff Images

Using ImageMagick with git (Source) to see differences in images:

Set alias "diff-img"

git config --global alias.diff-img difftool\ -x\ \''compare -alpha copy "$LOCAL" "$REMOTE" png:- | montage -mode concatenate "$LOCAL" png:- "$REMOTE" png:- | display -title "$BASE: Local | Diff | Remote" png:-'\'

or as a script for ~/bin/git-diff-img

#!/usr/bin/env sh
# $@ images
exec git difftool -x '
  compare -alpha copy "$LOCAL" "$REMOTE" png:- |
  montage -mode concatenate "$LOCAL" png:- "$REMOTE" png:- |
  display -title "$BASE: Local | Diff | Remote" png:-
' "$@"

Execute against png images only:

git diff-img **.png
Back to top