JImage: transparent png probelm(s)

Locked
User avatar
Batch1211
Joomla! Intern
Joomla! Intern
Posts: 85
Joined: Sat Sep 02, 2006 6:11 pm
Location: Schwerin, Germany

JImage: transparent png probelm(s)

Post by Batch1211 » Wed Feb 01, 2012 1:14 pm

Hey everyone,

I recognized some strange behavior using JImage with transparent images. I want to show you two examples:

The code for this examples is:

Code: Select all

jimport('joomla.image.image');
$image1 = new JImage(JPATH_COMPONENT.DS.'test'.DS.'unprocessed.png');
$image2 = new JImage(JPATH_COMPONENT.DS.'test'.DS.'preprocessed.png');

$properties1 = Jimage::getImageFileProperties(JPATH_COMPONENT.DS.'test'.DS.'unprocessed.png');
$properties2 = Jimage::getImageFileProperties(JPATH_COMPONENT.DS.'test'.DS.'preprocessed.png');

$image1->toFile(JPATH_COMPONENT.DS.'test'.DS.'unprocessed_after.png', $properties1->type);
$image2->toFile(JPATH_COMPONENT.DS.'test'.DS.'preprocessed_after.png', $properties2->type);
Let's start with $image1. The image is a normal png image with transparent background. All the code does is create a JImage instance and save the image again to the same directory with a different name. Since the image has not been altered at all, the image should look exactly the same. However, you see the result. They do not.

Since I can only upload a maxium of three images, the next example will be in the next post.
You do not have the required permissions to view the files attached to this post.

User avatar
Batch1211
Joomla! Intern
Joomla! Intern
Posts: 85
Joined: Sat Sep 02, 2006 6:11 pm
Location: Schwerin, Germany

Re: JImage: transparent png probelm(s)

Post by Batch1211 » Wed Feb 01, 2012 1:20 pm

The next example is even stranger:

The image preprocessed, seems to be exaclty the same. However, the image is a resized version of the image unprocessed.png. First of all it is strange that the problem described above does not happen, when we resize the image.

What is even stranger is the fact, that if we save the image to a file (without modifing it) that the transparent background of the image goes black.

So I have two questions. Can anyone recreate this problem? Does anyone have an idea, what's the problem here?
You do not have the required permissions to view the files attached to this post.


Locked

Return to “Joomla! 2.5 Beta Support”