Skip to content
MagickCmd › ImageMagick colour and tone commands

ImageMagick colour and tone commands

Adjust colour and tone with ImageMagick: proper weighted grayscale, brightness and contrast, saturation via -modulate, auto-level, gamma and sepia. With working examples.

Convert to black and white properly

magick input.jpg -colorspace Gray output.jpg

This uses correct luminance weighting — human eyes are far more sensitive to green than to blue, and -colorspace Gray accounts for that. Two lookalikes that are worse:

  • -type Grayscale changes how the file is stored, not the pixel values.
  • -modulate 100,0 zeroes saturation without luminance weighting, producing a flatter, muddier result.

Brightness and contrast

magick input.jpg -brightness-contrast 10x15 output.jpg

Both values run from -100 to 100, brightness first. This is a linear adjustment, which means it can clip highlights. For a gentler lift that protects them, use gamma instead:

magick input.jpg -gamma 1.2 output.jpg

Gamma above 1 brightens midtones while leaving pure white and pure black alone. Below 1 deepens them.

Saturation and hue

magick input.jpg -modulate 100,130,100 output.jpg

-modulate takes brightness, saturation, hue as percentages where 100 means unchanged. So the above leaves brightness alone, raises saturation by 30%, and leaves hue alone. Shifting hue is the third value:

magick input.jpg -modulate 100,100,120 output.jpg

Automatic fixes

CommandWhat it does
-auto-levelStretches each RGB channel independently to the full range. Fixes flat, hazy photos, but because the channels move separately it can introduce a colour cast.
-normalizeStretches overall contrast keeping the channels in step. Safer, less dramatic.
-auto-gammaAdjusts gamma to bring the mean brightness to the middle. Good for consistently under- or over-exposed batches.
-contrast-stretch 1x1%Like auto-level but ignores the brightest and darkest 1%, so a single blown highlight does not ruin the result.

A safe all-round web preset

magick input.jpg -auto-level -modulate 102,112,100 \
  -unsharp 0x0.8+0.7+0.01 -quality 85 output.jpg

Auto levels, a small saturation and contrast lift, then gentle sharpening. A reasonable default for product photos heading to a website.

Tints and tones

magick input.jpg -sepia-tone 80% output.jpg
magick input.jpg -negate output.jpg
magick input.jpg -fill '#0d9488' -colorize 25% output.jpg
magick input.jpg -colorspace Gray -fill '#c08040' -tint 60% output.jpg

Reduce the number of colours

magick input.png -colors 16 output.png
magick input.png +dither -colors 16 output.png

Dithering is on by default. It makes gradients look smoother but increases file size and produces visible noise on flat areas — +dither turns it off, which is usually what you want for logos and UI graphics.


Related

Copied