Is there a command line sequence that let me figure out if an image has fully transparent pixels?
And is it possible to generate an alpha channel for this image where all fully transparent pixels are black and all solid pixels are white?
It should be possible that semi transparent pixels should get gray in the alpha channel. The more a pixel is transparent in the image the darker the gray level for the representing pixel in the alpha channel should be.
Determine transparent pixels and generate alpha channel
-
- Posts: 5
- Joined: 2010-02-08T06:47:10-07:00
- Authentication code: 8675309
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Determine transparent pixels and generate alpha channel
Two of many options:mhoehn@hotmail.de wrote: And is it possible to generate an alpha channel for this image where all fully transparent pixels are black and all solid pixels are white?
It should be possible that semi transparent pixels should get gray in the alpha channel. The more a pixel is transparent in the image the darker the gray level for the representing pixel in the alpha channel should be.
Code: Select all
convert in.png -alpha extract alpha1.png
convert in.png -channel matte -separate +channel -negate alpha2.png
I'm not clear what form you would like the answer to take. Here is one option that gives you a count of the fully transparent pixels:mhoehn@hotmail.de wrote: Is there a command line sequence that let me figure out if an image has fully transparent pixels?
Code: Select all
convert alpha1.png -threshold 0 -format "%c" histogram:info: