How to identify image is totally white?
-
- Posts: 3
- Joined: 2015-04-10T02:59:30-07:00
- Authentication code: 6789
How to identify image is totally white?
Could please let me know what options should use to identify the image is totally white
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to identify image is totally white?
If an image is entirely white then the minimum value in each of the RGB channels is 100% (or 1 in a scale of 0.0 to 1.0).
By finding these three values, and taking the minimum of them, a result of "1" means all pixels are white. A lesser value means not all pixels are white.
By finding these three values, and taking the minimum of them, a result of "1" means all pixels are white. A lesser value means not all pixels are white.
Code: Select all
convert -precision 15 in.png -format "%[fx:min(minima.r,min(minima.g,minima.b))]" info:
snibgo's IM pages: im.snibgo.com
-
- Posts: 3
- Joined: 2015-04-10T02:59:30-07:00
- Authentication code: 6789
Re: How to identify image is totally white?
Thanks for very quick reply. Actually my requirement is we should fill a text and draw an image in totally white images using ImageMagick
Is there any direct commands to do that? If not, could you please suggest me how to do that.
Is there any direct commands to do that? If not, could you please suggest me how to do that.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to identify image is totally white?
I don't understand what you want.
snibgo's IM pages: im.snibgo.com
Re: How to identify image is totally white?
I have no idea either - link to a sample showing what you want.
What have you tried? What platform and language are you using?
What have you tried? What platform and language are you using?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to identify image is totally white?
If the image is totally pure white, then the average of the image will be white.
white
So test your image the same way
Code: Select all
convert -size 100x100 xc:white -scale 1x1! -format "%[pixel:u.p{0,0}]" info:
So test your image the same way
Code: Select all
convert yourimage -scale 1x1! -format "%[pixel:u.p{0,0}]" info:
-
- Posts: 3
- Joined: 2015-04-10T02:59:30-07:00
- Authentication code: 6789
Re: How to identify image is totally white?
Thanks to each and everyone for suggestions.
Here is my requirement
For example: There is an image(a.jpg) which is totally white.
As per my requirement, if image is totally white then we should embed or draw another image (logo.jpg) on a.jpg. Similarly, we should add a text on a.jpg.
Could you please let me know commands or options to do it.
Here is my requirement
For example: There is an image(a.jpg) which is totally white.
As per my requirement, if image is totally white then we should embed or draw another image (logo.jpg) on a.jpg. Similarly, we should add a text on a.jpg.
Could you please let me know commands or options to do it.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to identify image is totally white?
What is your version of IM and platform? scripting is different for Windows and Unix.
What you say totally white, is there any tolerance to slightly not white?
What you say totally white, is there any tolerance to slightly not white?