summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-09-15 09:47:12 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-09-15 09:47:12 +0000
commitf1edf87d04129b6ade9ef1eacf49ab4109fe1b14 (patch)
tree3da5115a6e2068696edf38b35292c2c473e76c07
parent6db93ab8ba4ca496feadf6267ab6d2c42187ef39 (diff)
downloadnginx-f1edf87d04129b6ade9ef1eacf49ab4109fe1b14.tar.gz
nginx-f1edf87d04129b6ade9ef1eacf49ab4109fe1b14.tar.bz2
fix alpha-channel transparency in PNG
-rw-r--r--src/http/modules/ngx_http_image_filter_module.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c
index 653cc791b..70b27310c 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 @@ ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
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 @@ ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
"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);