diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 2664288162a7..7265758696ad 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -960,7 +960,9 @@ static int gdImageTileGet (gdImagePtr im, int x, int y) srcy = y % gdImageSY(im->tile); p = gdImageGetPixel(im->tile, srcx, srcy); - if (im->trueColor) { + if (p == im->tile->transparent) { + tileColor = im->transparent; + } else if (im->trueColor) { if (im->tile->trueColor) { tileColor = p; } else { diff --git a/ext/gd/tests/gh17349.phpt b/ext/gd/tests/gh17349.phpt new file mode 100644 index 000000000000..cd0fc4317b59 --- /dev/null +++ b/ext/gd/tests/gh17349.phpt @@ -0,0 +1,27 @@ +--TEST-- +GH-17349 (Tiled truecolor filling looses single color transparency) +--EXTENSIONS-- +gd +--FILE-- + +--EXPECT-- +The images are equal. diff --git a/ext/gd/tests/gh17349.png b/ext/gd/tests/gh17349.png new file mode 100644 index 000000000000..dd75d9df9904 Binary files /dev/null and b/ext/gd/tests/gh17349.png differ