imagemagick

imagemagick is a command-line image manipulation tool.

table of contents

precedence

options are done in order, so an option needs to be before other options to effect them. for example to turn off dithering with +dither, you have to put that before other things that would use dithering.

colors

invert colors

use the -negate option

convert colors to monochrome

use the -monochrome option

convert to grayscale

use -colorspace gray.

you can limit the number of colors with -colors and turn off dithering with +dither, though this seems to really highlight artifacts if using jpeg.

occationally, especially if you only have a few colors, this can actually produce larger file sizes than just normal indexed colors. if using PNG, you can prefix the filename with PNG8: to force normal colors which can then be indexed using something like pngo. do check the size though, this can also make the size much larger.

remove alpha

use the -flatten option for this. you can also set the -background color to a color beforehand if you want to replace the alpha with a specific color.

local adaptive threshold

the -lat option takes window dimentions and an offset as an argument, and then does a local threshold to get 1-bit color that still preserves detail even with darker/lighter areas.

may benefit from -flatten and -colorspace gray beforehand. oddly this sometimes makes it output fully transparent images, not sure why but an offset of -1 (ie 30x30-1) seems to fix this...

transforms

flip flops

-flip and -flop will vertically and horizontally flip an image respectively