Page 1 of 1
How to identify image is totally white?
Posted: 2015-04-10T03:06:24-07:00
by sripvk1234
Could please let me know what options should use to identify the image is totally white
Re: How to identify image is totally white?
Posted: 2015-04-10T03:35:03-07:00
by snibgo
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.
Code: Select all
convert -precision 15 in.png -format "%[fx:min(minima.r,min(minima.g,minima.b))]" info:
Re: How to identify image is totally white?
Posted: 2015-04-10T04:13:20-07:00
by sripvk1234
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.
Re: How to identify image is totally white?
Posted: 2015-04-10T04:37:18-07:00
by snibgo
I don't understand what you want.
Re: How to identify image is totally white?
Posted: 2015-04-10T05:01:46-07:00
by Bonzo
I have no idea either - link to a sample showing what you want.
What have you tried? What platform and language are you using?
Re: How to identify image is totally white?
Posted: 2015-04-10T08:38:46-07:00
by fmw42
If the image is
totally pure white, then the average of the image will be white.
Code: Select all
convert -size 100x100 xc:white -scale 1x1! -format "%[pixel:u.p{0,0}]" info:
white
So test your image the same way
Code: Select all
convert yourimage -scale 1x1! -format "%[pixel:u.p{0,0}]" info:
Re: How to identify image is totally white?
Posted: 2015-04-12T22:52:12-07:00
by sripvk1234
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.
Re: How to identify image is totally white?
Posted: 2015-04-13T08:36:30-07:00
by fmw42
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?