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.
How to determine the brightness of an area in a picture
Re: How to determine the brightness of an area in a picture
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.
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
That sounds promissing.Bonzo wrote:One method would be to crop the area of an image you want the details for, resize it smaller, and use -identify.
I want to do this in a shell script (thus: command line) on Linux.How you get the information from -identify would depend on what you were using e.g. command line, php Perl etc.
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
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.phpWolfgang 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?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to determine the brightness of an area in a picture
use
convert imagename.suffix[widthxheight+xoffset+yoffset] -verbose info:
See:
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/files/#info
http://www.imagemagick.org/Usage/scripts/
http://www.cit.gu.edu.au/~anthony/info/ ... ript.hints
convert imagename.suffix[widthxheight+xoffset+yoffset] -verbose info:
See:
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/files/#info
http://www.imagemagick.org/Usage/scripts/
http://www.cit.gu.edu.au/~anthony/info/ ... ript.hints
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to determine the brightness of an area in a picture
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:
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/