1--TEST-- 2imagegd() writes truecolor images without palette conversion 3--EXTENSIONS-- 4gd 5--SKIPIF-- 6<?php 7 if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) { 8 die("skip test requires GD 2.3.2 or older"); 9 } 10?> 11--FILE-- 12<?php 13require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; 14 15$im = imagecreatetruecolor(10, 10); 16$white = imagecolorallocate($im, 255, 255, 255); 17imagefilledrectangle($im, 0,0, 9,9, $white); 18$blue = imagecolorallocate($im, 0, 0, 255); 19imagefilledrectangle($im, 3,3, 6,6, $blue); 20 21ob_start(); 22imagegd($im); 23$buffer = ob_get_clean(); 24 25$header = unpack('nsignature/nwidth/nheight/Ctruecolor', $buffer); 26printf("signature: %d\n", $header['signature']); 27printf("truecolor: %d\n", $header['truecolor']); 28printf("size: %d\n", strlen($buffer)); 29 30test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagegd_truecolor.png', $im); 31?> 32--EXPECT-- 33signature: 65534 34truecolor: 1 35size: 411 36The images are equal. 37