I am working on a service that can do conversions from gif to mp4 files (with ffmpeg
).
My problem is some of the gifs have visible transparent areas which end up as white color when I convert them to mp4 video. To avoid that problem I am trying detect if a gif has visible transparent areas so I will avoid converting them to mp4.
I tried to use getImageAlphaChannel()
function from imagick.
if ($imagick->getImageAlphaChannel()) {
echo 'transparent image';
} else {
echo 'not transparent image';
}
This function works correctly reports transparent for images like below; which has obvious visible transparent areas.
But it also reports transparent for images like below;
This result is probably correct for imagick , probably above images are transparent , but according to my eyes there are no visible transparent areas.
My question is how can I correctly identify, if a gif file that has visible transparent areas or it is even possible with imagick or any other tool ?