ImageMagick
From DWIKI
Links
FAQ
Extract images from animated gif
convert img.gif -coalesce img/xx_%05d.png
Shrink filesize
convert in.jpg -define jpeg:extent=512kb out.jpg
Convert to favicon
convert -define icon:auto-resize=256,64,48,32,16 foo.png favicon.ico
Check formats supported by your imagemagick
convert --version
or
magick -list format