--TEST-- png compression test --EXTENSIONS-- gd --SKIPIF-- --FILE-- getMessage() . PHP_EOL; } try { imagepng($im, $cwd . '/test_pngcomp.png', 10); } catch (\ValueError $e) { echo $e->getMessage() . PHP_EOL; } echo "PNG compression test: "; imagepng($im, $cwd . '/test_pngcomp.png', 9); $im2 = imagecreatefrompng($cwd . '/test_pngcomp.png'); $col = imagecolorat($im2, 8,8); if ($col == 0xffffff) { echo "ok\n"; } @unlink($cwd . "/test_pngcomp.png"); ?> --EXPECT-- imagepng(): Argument #3 ($quality) must be between -1 and 9 imagepng(): Argument #3 ($quality) must be between -1 and 9 PNG compression test: ok