fix alpha-channel transparency in PNG
diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c
index 653cc79..70b2731 100644
--- a/src/http/modules/ngx_http_image_filter_module.c
+++ b/src/http/modules/ngx_http_image_filter_module.c
@@ -768,6 +768,11 @@
return NULL;
}
+ if (colors == 0) {
+ gdImageSaveAlpha(dst, 1);
+ gdImageAlphaBlending(dst, 0);
+ }
+
gdImageCopyResampled(dst, src, 0, 0, 0, 0, dx, dy, sx, sy);
gdImageDestroy(src);
@@ -810,6 +815,11 @@
"image crop: %d x %d @ %d x %d",
dx, dy, ox, oy);
+ if (colors == 0) {
+ gdImageSaveAlpha(dst, 1);
+ gdImageAlphaBlending(dst, 0);
+ }
+
gdImageCopy(dst, src, 0, 0, ox, oy, dx - ox, dy - oy);
gdImageDestroy(src);