?
avatar n3t
n3t
8 Aug 2015

Joomla 3.x introduced some changes to JImage class which influence quality of resized PNGs with transparency. To demonstrate it see this images:

Original
test

Resized in Joomla 2.5
j25

Resized in Joomla 3
j30

Test code to resize is

      $original = new JImage($src);
      $original->resize(140,140,false, JImage::SCALE_INSIDE);
      $original->toFile($dest,IMAGETYPE_PNG);

Tested on PHP 5.3.29 with GD 2.1.0 compatible, libPNG 1.6.12
and on PHP 5.5.27 with GD 2.1.0 compatible, libPNG 1.2.49

this behavior is caused by setting explicitly transparent color in loadFile method. For some reason isTransparent() returns false in this case, so transparent color is set explicitly causing the image look like that.

I am not sure why this code is at this place (loading image), as it seems to solve black background issue, when SCALE_FIT is used on resizing. However in resize method it is introduced again.

avatar n3t n3t - open - 8 Aug 2015
avatar n3t
n3t - comment - 8 Aug 2015

This patch solves the issue
n3t@6755fdf

avatar brianteeman
brianteeman - comment - 8 Aug 2015

Please submit that as a pull request

avatar n3t
n3t - comment - 8 Aug 2015

Pull request here #7658

avatar zero-24 zero-24 - close - 8 Aug 2015
avatar Bakual
Bakual - comment - 8 Aug 2015

Closing this issue since we have a PR.

avatar Bakual Bakual - change - 8 Aug 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-08-08 11:18:35
Closed_By Bakual
avatar Bakual Bakual - close - 8 Aug 2015
avatar zero-24 zero-24 - change - 9 Aug 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment