xref: /PHP-8.2/ext/gd/tests/bug72913.phpt (revision a375d547)
1--TEST--
2Bug #72913 (imagecopy() loses single-color transparency on palette images)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7$base64 = 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAABnRSTlMAAAAAAABu'
8    . 'pgeRAAAAVklEQVRYw+3UQQqAMBAEwf3/p9eTBxEPiWAmWMU8oGFJqgAAuOpzWTX3'
9    . 'xQUti+uRJTZ9V5aY1bOTFZLV7yZr9zt6ibv/qPXfrMpsGipbIy7oqQ8AYJED1plD'
10    . 'y5PCu2sAAAAASUVORK5CYII=';
11$src = imagecreatefromstring(base64_decode($base64));
12
13$dst = imagecreate(50, 50);
14$transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127);
15imagealphablending($dst, false);
16imagesavealpha($dst, true);
17
18imagecopy($dst, $src, 0,0, 0,0, 50,50);
19
20include_once __DIR__ . '/func.inc';
21test_image_equals_file(__DIR__ . '/bug72913.png', $dst);
22?>
23--EXPECT--
24The images are equal.
25