Resize Artifact
Issue #99
new
Hi Pierre,
Following your recommandation on the mailing list I open a new issue : If I resize a picture to a size which is not a multiple of the original size I have artifacts on the white background.
I just had a test on php5.53 and the bug is still here :
Here is the code I used to test (test.jpg is a 1000x1000 jpeg)
<?php
$filename = 'test.jpg';
$percent = $_GET["scale"] ? $_GET["scale"] : 1;
// Content type
header('Content-Type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($image_p, null, 100);
You can find the resulting jpg in attachment (If you can't see the artifact just add contrast in photoshop)
A better testcase: