Testing for image transparency
Posted: 2019-05-24T01:57:46-07:00
I'm using a Python library that creates pngs, but once in a blue moon, generates a set of pngs that are essentially just transparent. I have no idea why and it's a rare enough event not to want to bother investigating.
The images are intended for social media, and I'd like to be able to test for transparency before they get sent & if there's a problem, we can rerun the image generator & alert the admin (me).
I found this snippet of code on a (very) old post, and it works perfectly (on Linux 32bit IM 6.9.10), but I wondered if there is a neater/quicker/whatever equivalent for both 6.9 and 7.x ?
The images are intended for social media, and I'd like to be able to test for transparency before they get sent & if there's a problem, we can rerun the image generator & alert the admin (me).
I found this snippet of code on a (very) old post, and it works perfectly (on Linux 32bit IM 6.9.10), but I wondered if there is a neater/quicker/whatever equivalent for both 6.9 and 7.x ?
Code: Select all
convert image -matte -channel A -separate -format '%[fx:image.maxima]' info: