Page 1 of 1

Alter brightness and contrast of parts of an image

Posted: 2013-04-14T07:48:18-07:00
by spirofantasio1
I'm not very advanced and when it comes to Imagemagick I would rather stick to command-prompt rather than Perl or other advanced programming.

Bascially, what I want to do is vary the brightness and contrast of parts of an image rather than the whole thing. Something like this:

Image

Can it be done? Thank you.

Re: Alter brightness and contrast of parts of an image

Posted: 2013-04-14T08:50:08-07:00
by snibgo
Your image didn't come through. But yes, that's easy. For example:

Code: Select all

convert img.png -mask mask.png -level 30%%,60%% +mask imgOut.png
This takes img.png, changes the brightness and contrast but only where the mask is black, with the effect fading to nothing where the mask is white.

See http://www.imagemagick.org/script/comma ... s.php#mask

Re: Alter brightness and contrast of parts of an image

Posted: 2013-04-14T10:30:00-07:00
by spirofantasio1
Sorry, I was not very clear. What I want to do is vary the brightness and contrast of parts of the image in order to make little squares appear but keeping the background essentially intact.

Here's a link to the kind of image I want to end up with:
http://img295.imagevenue.com/img.php?im ... _496lo.jpg

Re: Alter brightness and contrast of parts of an image

Posted: 2013-04-14T10:51:32-07:00
by Bonzo
I had two other windows open as well as the image when I followed that link and one was a porn link :(

As snibgo said create a mask with square black boxes where you want the light areas.

Re: Alter brightness and contrast of parts of an image

Posted: 2013-04-14T15:30:15-07:00
by spirofantasio1
Sorry about the links to the porn sites. When I uploaded the image I did specify that this was a family-friendly image and my Firefox is designed to block pop-up boxes so I was unaware of this.

Anyway, I researched the "mask" option and this led to the "region" option which provided me with what I required:

convert flowers.jpg -region 115x140+45+10 -brightness-contrast -70x-20 -region 115x140+45+170 -brightness-contrast -70x-20 flowers2.jpg

Thank you for the pointers.