Imagemagick

From wikinotes
Revision as of 18:18, 17 July 2020 by Will (talk | contribs) (→‎gui)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Imagemagick is a program similar to ffmpeg, except instead of primarily targeting videos, imagemagick's primary focus is images.

Usage

Imagemagick is built on a handful of base commands:

  • identify
  • convert
  • mogrify

gui

Suitable for simple operations like cropping/resizing.

pacman -S graphicsmagick
gm display img.png  # right click for options

identify format

Using identify format you can pick out the information you'd like to obtain from the image.

https://imagemagick.org/script/escape.php

identify -format '%[scene] ' file.psd  # in this case layer-number

image sequence to gif/mng

convert \
   -resize 100x100! /path/frame-01.png \
   -resize 100x100! /path/frame-02.png \  
   /path/to/output.mng

convert -delay 20 F_*.png -loop 0 movie.gif

flat colour with title

convert \
    -size 64x64 \
    xc:rgba(200,100,100,255) \
    -gravity Center -annotate 0 'your title' \
    output.svg

generating .ico files

convert logo.png -define icon:auto-resize=256,64,48,32,16 logo.ico

https://en.wikipedia.org/wiki/ICO_(file_format)

extracting PSD layers

for i in $(identify -format "%[scene] " <filename>.psd); do 
    convert <filename>.psd[$i] <extracted-filename>-$i.png;
done