Forums / Developer / PNG image resize loose transparency
Olivier Versanne
Monday 06 July 2009 4:39:35 am
Hi,
I'm using eZ Image filters to resize my PNG pictures.
Here my image.ini.append.php :
<?php /* #?ini charset="iso-8859-1"? [AliasSettings] AliasList[]=alternate_view [alternate_view] Reference=reference Filters[]=geometry/scaledownonly=45;45 */
And, when I try to view the resized picture, I get a black background instead of transparency background.I think this problem comes from the grafical module that eZ is using. How could I know which extension eZ uses, and how could I change it? (Imagick / GD... or another that works with eZ).
Thanks,
Olivier.
André R.
Monday 06 July 2009 5:24:25 am
This is controlled by image.ini settings, and if ImageMagic is not used (as in GD is used instead), you can see that in settings/override/image.ini.append.php with content like this:
[ImageMagick] IsEnabled=false
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription @: http://twitter.com/andrerom
Monday 13 July 2009 4:24:23 am
Thanks!
Vytautas Germanavičius
Thursday 08 October 2009 4:52:09 am
after i switched to gd i lost transparency on all png images.
Has anyone solution for this?
i filled issue:http://issues.ez.no/IssueView.php?Id=15640&activeItem=1
{set-block scope=root variable=cache_ttl}0{/set-block}
Friday 17 June 2011 8:22:21 am
This message gave me idea http://stackoverflow.com/questions/32243/can-png-image-transparency-be-preserved-when-using-phps-gdlib-imagecopyresampled
And i made small changes in ezimagegdhandler.php: i added
imagealphablending( $temporaryImageObject, false ); imagesavealpha( $temporaryImageObject, true );
after
$temporaryImageObject = eZImageGDHandler::imageCreate( $destinationWidth, $destinationHeight, eZImageGDHandler::isImageTrueColor( $imageObject, $sourceMimeData ) );
It saves PNG transparency before resizing.
I made patch, if someone is interested. http://issues.ez.no/IssueView.php?Id=15640&activeItem=1