PNG image resize loose transparency

Author Message

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

Olivier Versanne

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}

Vytautas Germanavičius

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

{set-block scope=root variable=cache_ttl}0{/set-block}

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:50:35
Script start
Timing: Jan 18 2025 02:50:35
Module start 'layout'
Timing: Jan 18 2025 02:50:35
Module start 'content'
Timing: Jan 18 2025 02:50:35
Module end 'content'
Timing: Jan 18 2025 02:50:35
Script end

Main resources:

Total runtime0.0138 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 587.9375152.6250
Module start 'layout' 0.00450.0025 740.562539.4453
Module start 'content' 0.00700.0045 780.007893.5547
Module end 'content' 0.01160.0022 873.562538.3047
Script end 0.0138  911.8672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002518.1048140.0002
Check MTime0.00118.2440140.0001
Mysql Total
Database connection0.00064.379110.0006
Mysqli_queries0.002316.355230.0008
Looping result0.00000.079410.0000
Template Total0.001813.010.0018
Template load0.00096.710110.0009
Template processing0.00086.108010.0008
Override
Cache load0.00064.551710.0006
General
dbfile0.00031.873880.0000
String conversion0.00000.036240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs