1

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 1

1

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

enter image description here

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

enter image description here


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

enter image description here


If you a re familiar with Photoshop Levels/Curves, I am suggesting the equivalent of the white line in this curve:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .