Closed brianjhanson closed 1 year ago
I think getImageAlphaChannel()
returning true
is correct here as the image has an alpha channel at this point (even though it might not be used).
To determine if the image has any transparency maybe the following code can help? (untested)
$alphaRange = $image->getImagick()->getImageChannelRange(Imagick::CHANNEL_ALPHA);
$isTransparent = $alphaRange['minima'] < $alphaRange['maxima'];
Thank you @ausi! I was just coming around to the same feeling. I'm not super familiar with this library, so it took me most of the day to reason around what was happening.
This was a bug reported in our CMS so I'll fix it over there and close things here.
Thanks again, that snippet worked perfectly.
👍
Maybe such a hasTransparency()
method would be a good addition to this library too. But I’m not sure how easy this is to achieve with the other drivers (GD and GMagick).
Issue description
798 changed the logic surrounding alpha channels and seems to have caused the
$image->getImagick()->getImageAlphaChannel()
to returntrue
for JPG.What version of Imagine are you using?
1.3.3
What's the PHP version you are using?
What's the imaging library you are using [gd/imagick/gmagick/any]?
imagick
What's the imaging library configuration
Minimal PHP code to reproduce the error:
The exact images I used in this example are below
Output Screenshot
Assets used