summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/gd/libgd/gd.c1
-rw-r--r--ext/gd/libgd/gd_png.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index cfb50d4efd..d00c697016 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -2620,6 +2620,7 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
green /= spixels;
blue /= spixels;
alpha /= spixels;
+ alpha += 0.5;
}
if ( alpha_sum != 0.0f) {
if( contrib_sum != 0.0f) {
diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c
index a002a95212..7591dc0c67 100644
--- a/ext/gd/libgd/gd_png.c
+++ b/ext/gd/libgd/gd_png.c
@@ -689,7 +689,12 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level, int basefilte
*/
a = gdTrueColorGetAlpha(thisPixel);
/* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */
- *pOutputRow++ = 255 - ((a << 1) + (a >> 6));
+ if (a == 127) {
+ *pOutputRow++ = 0;
+ } else {
+ *pOutputRow++ = 255 - ((a << 1) + (a >> 6));
+ }
+
}
}
}