It is almost the holiday season and to my surprise it is unfortunately already snowing in my transparent images. :nono:
The situation is that I am uploading transparent PNG images with the given code below and the result is that there is noise in the final image.
Searching the web for answers tells me that more people had this but any solution is not to be found
only PHP.net shows me that in the past there where even some bug reports about it.
Switching from imagecopyresampled to imagecopyresized solves it but then the quality of the image is to cry for.
Can anyone tell me more about the problem, if you also encountered it and what you did to fix it?
$new_image= imagecreatetruecolor($new_width, $new_height);
$transparent= imagecolorallocatealpha($new_image, 255, 255, 255, 127);
imagefilledrectangle($new_image, 0, 0, $new_width, $new_height, $transparent);
imagecopyresampled($new_image, $original_file, 0, 0, 0, 0, $new_width, $new_height, $orig_width, $orig_height);
Image result example (boosted result image so it's easy to see what I mean)
Can you try Imagemagick ?
I am not that good at GD but in an example I made a while ago I used imagecolortransparent ( $canvas, $white ); The example is half way down this page: Watermark with GD