From c7a7471c35c803c130d2bfa7fc1a57967364c91e Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 17 Sep 2016 19:19:51 +0800 Subject: tiff: Do not assume that images always have alpha component. --- source/fitz/load-tiff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/fitz/load-tiff.c') diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index 8f4c2629..ace925d8 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -871,6 +871,7 @@ fz_load_tiff_subimage(fz_context *ctx, unsigned char *buf, size_t len, int subim { fz_pixmap *image; struct tiff tiff = { 0 }; + int alpha; fz_try(ctx) { @@ -891,7 +892,8 @@ fz_load_tiff_subimage(fz_context *ctx, unsigned char *buf, size_t len, int subim fz_swap_tiff_byte_order(tiff.samples, tiff.imagewidth * tiff.imagelength * tiff.samplesperpixel); /* Expand into fz_pixmap struct */ - image = fz_new_pixmap(ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength, 1); + alpha = tiff.extrasamples != 0; + image = fz_new_pixmap(ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength, alpha); image->xres = tiff.xresolution; image->yres = tiff.yresolution; -- cgit v1.2.3