1--TEST-- 2Bug #53580 (During resize gdImageCopyResampled cause colors change) 3--SKIPIF-- 4<?php 5if (!extension_loaded('gd')) die("skip gd extension not available"); 6if (!GD_BUNDLED && version_compare(GD_VERSION, "2.3.2") <= 0) { 7 die("skip test requires GD > 2.3.2"); 8} 9?> 10--FILE-- 11<?php 12$w0 = 100; 13$h0 = 100; 14$w1 = 150; 15$h1 = 150; 16$c0 = 0xffffff; 17 18$im0 = imagecreatetruecolor($w0, $h0); 19imagefilledrectangle($im0, 0, 0, $w0 - 1, $h0 - 1, $c0); 20 21$im1 = imagecreatetruecolor($w1, $h1); 22imagecopyresampled($im1, $im0, 0, 0, 0, 0, $w1, $h1, $w0, $h0); 23 24for ($i = 0; $i < $w1; $i++) { 25 for ($j = 0; $j < $h1; $j++) { 26 if (($c1 = imagecolorat($im1, $i, $j)) !== $c0) { 27 printf("%d,%d = %d\n", $i, $j, $c1); 28 } 29 } 30} 31?> 32--EXPECT-- 33