-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transparency information is lost #65
Comments
It is not a known problem. I just tried your sample image, both passed through at 320x320 and resized to 200x200 and transparency was preserved as expected. Perhaps if you add
to the end of your code sample you can get the debug log. Search through there for references to "alpha" (e.g. "AlphaChannelFlatten"). Also please confirm whether the image is being processed through GD or ImageMagick in your installation, and if applicable what version of ImageMagick is installed. If the debug messages don't point you to the right solution immediately, please copy-paste all the lines references "alpha" or "imagemagick" here. |
I am having the same problem, transparency in PNGs is lost in all instances. Environment: Ubuntu 14.04 The fail is visible even in the phpthumb demo page: Here is the debug log for the test phpThumb.php?src=images%2Falpha.png&f=png
|
Does e9a8cea (remove |
Do you have ImageMagick 6.7.7-10 ? Release date of it was ?: 2012-06-29 Latest: Older: Here you can see 6.7.7-10 has release date: 2012-06-29 I think ImageMagick had a bug with alpha transparency that was fixed after 6.8.nn ? http://superuser.com/questions/636008/convert-bmp-to-png-while-preserving-alpha-channel The above link, speaks about bmp to png, but does not say if bug applies to png to png too I do not know if removing -flatten is enough, and if removing it will create problems with other cases
|
In both my local development environment, and the public server I have: imagick module enabled |
@ggppdk I don't know how to check that, I found the directory /usr/include/php5/ext/imagick containing 3 .h files. @ggppdk the problem was fixed by rolling back to the phpthumb version used in FC 3.0.14-rc @JamesHeinrich I will test using the library including that commit and let you know if that fixes the problem |
@JamesHeinrich the latest commit fixes the problem. Thank you! |
Unfortunately my "fix" may also break some things, like PDF as source image, so I don't really want to leave it in place if it's a buggy ImageMagick causing the problem. Any chance you're able to upgrade ImageMagick to v6.8.9+ and test with |
Can "-flatten" be removed only if input source is "png" ? or even this will cause problems: |
|
Right, but is it possible to remove it only for PNG input format ? There are quite a few servers that have older ImageMagick versions (or GD? versions) that do not work with it, and loose the PNG transparency I have tested moving the getimagesize further up (in order to get the image type earlier) ob_start();
$getimagesize = getimagesize($this->sourceFilename);
$GetImageSizeError = ob_get_contents();
ob_end_clean(); and the exclude PNG from using -flatten // for vector source formats only (WMF, PDF, etc)
if (!is_array($getimagesize) || $getimagesize[2] != IMAGETYPE_PNG)
{
$commandline .= ' -flatten';
} It seems to be working properly |
Let me know if there are any problems with 6a9d994 |
Thanks this fixed the issue, tested in 2 different servers 1 server that had the issue with PNG transparency, |
Hello,
I'm using latest phpThumb from master and no matter what parameters I set, the trasparency information on the generated thumbnail is always lost.
The transparent png is this one:
![test-alpha](https://cloud.githubusercontent.com/assets/11565395/16579867/0b296f30-42a2-11e6-9ecf-19459a032375.png)
and the result.png is this (of course it looks identical because the background of the page here is also white!)
![result](https://cloud.githubusercontent.com/assets/11565395/16579989/b6eaeee8-42a2-11e6-894c-39ad2f35d20e.png)
Is this a known problem? Do you know of any workaround to preserve the transparency in the generated thumbnail?
Thanks!
The text was updated successfully, but these errors were encountered: