I have a grayscale image with pixels ranging from black to white. I'd like to make it brighter by moving the "black floor" up, and scaling the other pixel intensities. I'd prefer linear scaling but it's not too important. Is this possible with ImageMagick?
1 Answer
You can use the +level
command for this. Let's make a full-scale black-white gradient to start with:
magick -size 400x400 gradient:black-white start.jpg
I have artificially added a small red border so you can see its full extent on StackExchange's stupid background.
Now, suppose you want to move the black-point up from 0 to 40% black, but leave the white-point unchanged at 100% and linearly scale everything in between:
magick start.jpg +level 40,100% result.jpg
Note that if you don't specify the upper level, it assumes it is the same as the lower level, so this will chop 40% off both ends of the black-white scale:
magick start.jpg +level 40% result.jpg
If you a re familiar with Photoshop Levels/Curves, I am suggesting the equivalent of the white line in this curve: