Skip to content

Commit a3383ac

Browse files
committed
Fix for bug #45030
1 parent f02f9b0 commit a3383ac

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ext/gd/libgd/gd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,6 +2620,7 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
26202620
green /= spixels;
26212621
blue /= spixels;
26222622
alpha /= spixels;
2623+
alpha += 0.5;
26232624
}
26242625
if ( alpha_sum != 0.0f) {
26252626
if( contrib_sum != 0.0f) {

ext/gd/libgd/gd_png.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,12 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level, int basefilte
689689
*/
690690
a = gdTrueColorGetAlpha(thisPixel);
691691
/* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */
692-
*pOutputRow++ = 255 - ((a << 1) + (a >> 6));
692+
if (a == 127) {
693+
*pOutputRow++ = 0;
694+
} else {
695+
*pOutputRow++ = 255 - ((a << 1) + (a >> 6));
696+
}
697+
693698
}
694699
}
695700
}

0 commit comments

Comments
 (0)