Page 1 of 1
How to determine the brightness of an area in a picture
Posted: 2007-12-27T05:13:13-07:00
by Wolfgang
Hello,
I am new to this board. I searched for an answer but I didn't find any.
I use convert to put some text into pictures. Is there any way to determine the brightness and/or the colour within the targeted area of the picture, so that the colour of the text can be set appropriately?
Thanks in advance.
Re: How to determine the brightness of an area in a picture
Posted: 2007-12-27T06:45:05-07:00
by Bonzo
One method would be to crop the area of an image you want the details for, resize it smaller, and use -identify.
How you get the information from -identify would depend on what you were using e.g. command line, php Perl etc.
Re: How to determine the brightness of an area in a picture
Posted: 2007-12-28T04:55:18-07:00
by Wolfgang
Bonzo wrote:One method would be to crop the area of an image you want the details for, resize it smaller, and use -identify.
That sounds promissing.
How you get the information from -identify would depend on what you were using e.g. command line, php Perl etc.
I want to do this in a shell script (thus: command line) on Linux.
Can you tell me where I can find more information about this? Are there any examples available?
Re: How to determine the brightness of an area in a picture
Posted: 2007-12-28T07:37:47-07:00
by Slig
Wolfgang wrote:
I want to do this in a shell script (thus: command line) on Linux.
Can you tell me where I can find more information about this? Are there any examples available?
You can take a look at this lots of shell scripts. I'm almost sure you'll find how to get the return of identify:
http://www.fmwconcepts.com/imagemagick/index.php
Re: How to determine the brightness of an area in a picture
Posted: 2007-12-28T17:11:52-07:00
by fmw42
Re: How to determine the brightness of an area in a picture
Posted: 2008-01-02T17:09:46-07:00
by anthony
For brightness convert it to gray scale, and for outputing colors the txt: output is simplier
Code: Select all
convert image -crop WxH+X+Y -resize 1x1\! -colorspace gray txt: