How to Adjust Image Brightness with ImageMagick Convert?
Adjusting the brightness of an image is a frequent task in digital
image processing, and ImageMagick provides a powerful command-line
solution for this via its convert tool. This article covers
the exact syntax required to modify image brightness, explains how the
-modulate operator works, and provides practical examples
for both increasing and decreasing brightness levels. By the end of this
guide, you will be able to confidently execute these commands in your
terminal to batch-process or individually tune your images.
The Standard Syntax:
The -modulate Operator
The most efficient way to alter brightness in ImageMagick without
distorting the underlying color balance is by using the
-modulate operator. This operator controls three specific
image attributes: brightness, saturation, and hue.
The basic command structure looks like this:
convert input.jpg -modulate brightness,saturation,hue output.jpg
When using this syntax, ImageMagick uses a percentage-based system where 100 represents the original, unaltered state of the image.
- Brightness: The first value in the triplet.
- Saturation (Optional): The second value. If omitted, it defaults to 100.
- Hue (Optional): The third value. If omitted, it defaults to 100.
Practical Command Examples
To isolate and change only the brightness, you can adjust the first value while leaving the others at 100, or omit the trailing values entirely.
- To increase brightness by 20%:
convert input.jpg -modulate 120 output.jpgThis sets the brightness to 120% of the original value. - To decrease brightness by 30%:
convert input.jpg -modulate 70 output.jpgThis lowers the brightness to 70% of the original value. - To increase brightness while keeping saturation intact
explicitly:
convert input.jpg -modulate 150,100,100 output.jpg
Alternative Method:
The -evaluate Operator
If you prefer a direct mathematical adjustment rather than a relative
percentage based on the HSL (Hue, Saturation, Lightness) color space,
you can use the -evaluate operator. This method directly
modifies the pixel values.
- To brighten an image using addition:
convert input.jpg -evaluate Add 10% output.jpg - To darken an image using subtraction:
convert input.jpg -evaluate Subtract 15% output.jpg
For general photography and design assets, the -modulate
command is typically preferred as it preserves the natural color
relationships of the image much better than direct pixel addition.