mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
fix alpha-channel transparency in PNG
This commit is contained in:
parent
6db93ab8ba
commit
f1edf87d04
@ -768,6 +768,11 @@ ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (colors == 0) {
|
||||||
|
gdImageSaveAlpha(dst, 1);
|
||||||
|
gdImageAlphaBlending(dst, 0);
|
||||||
|
}
|
||||||
|
|
||||||
gdImageCopyResampled(dst, src, 0, 0, 0, 0, dx, dy, sx, sy);
|
gdImageCopyResampled(dst, src, 0, 0, 0, 0, dx, dy, sx, sy);
|
||||||
|
|
||||||
gdImageDestroy(src);
|
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",
|
"image crop: %d x %d @ %d x %d",
|
||||||
dx, dy, ox, oy);
|
dx, dy, ox, oy);
|
||||||
|
|
||||||
|
if (colors == 0) {
|
||||||
|
gdImageSaveAlpha(dst, 1);
|
||||||
|
gdImageAlphaBlending(dst, 0);
|
||||||
|
}
|
||||||
|
|
||||||
gdImageCopy(dst, src, 0, 0, ox, oy, dx - ox, dy - oy);
|
gdImageCopy(dst, src, 0, 0, ox, oy, dx - ox, dy - oy);
|
||||||
|
|
||||||
gdImageDestroy(src);
|
gdImageDestroy(src);
|
||||||
|
Loading…
Reference in New Issue
Block a user