I need a png known to have transparent background. I built one starting from a pdf from powerpoint with
transparent background, magicked to png, checked this way following instructions elsewhere in this forum.
$ magick identify -verbose die12t.png | grep "Alpha"
Base type: TrueColorAlpha
Alpha: 8-bit
Alpha:
Alpha: graya(0,0) #00000000
png:IHDR.color_type: 4 (GrayAlpha)
I'd like confirmation that I'm OK. If not, what else should I do?
$ magick -version
Version: ImageMagick 7.0.5-1 Q16 x64 2017-03-04 http://www.imagemagick.org
is this png background transparent?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: is this png background transparent?
What does that mean?ebolker wrote:I need a png known to have transparent background.
The alpha statistics will tell you if the image has transparency. For example:
Code: Select all
Alpha:
min: 0 (0)
max: 255 (1)
mean: 94.4481 (0.370385)
standard deviation: 123.141 (0.482908)
kurtosis: -1.71183
skewness: -0.536812
entropy: 0.1282
snibgo's IM pages: im.snibgo.com
Re: is this png background transparent?
What my question means is that I did not know how to translate "Alpha = 0" to "background is transparent". Now I do. Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: is this png background transparent?
If you just want to know if the image is fully opaque or partially transparent, then you can use
See https://www.imagemagick.org/script/escape.php
If you want to know if the image is totally transparent, then use
if the result is exactly 0, then the image is fully transparent. If it is exactly 1, then it is fully opaque. If in-between, then some pixels have at least partial transparency.
Code: Select all
convert image -format "%[opaque]" info:
If you want to know if the image is totally transparent, then use
Code: Select all
convert image -alpha extract -format "%[fx:mean]" info: