Noise with ImageCopyResampled

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.
https://bugs.php.net/bug.php?id=45030
https://bugs.php.net/bug.php?id=41820

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?


$original_file= imagecreatefrompng($_FILES['image']['tmp_name']);
$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);
imagealphablending($new_image, false);
imagesavealpha($new_image,true);
					
imagecopyresampled($new_image, $original_file, 0, 0, 0, 0, $new_width, $new_height, $orig_width, $orig_height);		
imagePNG($new_image, $destination);

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