also support palette+alpha

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-10-03 20:56:53 +02:00
parent e265738ac2
commit 80393b6efa
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -85,7 +85,7 @@ FitMode = Enum("FitMode", "into fill exact shrink enlarge")
PageOrientation = Enum("PageOrientation", "portrait landscape") PageOrientation = Enum("PageOrientation", "portrait landscape")
Colorspace = Enum("Colorspace", "RGB RGBA L LA 1 CMYK CMYK;I P other") Colorspace = Enum("Colorspace", "RGB RGBA L LA 1 CMYK CMYK;I P PA other")
ImageFormat = Enum("ImageFormat", "JPEG JPEG2000 CCITTGroup4 PNG GIF TIFF MPO other") ImageFormat = Enum("ImageFormat", "JPEG JPEG2000 CCITTGroup4 PNG GIF TIFF MPO other")
@ -1586,6 +1586,7 @@ def read_images(rawdata, colorspace, first_frame_only=False, rot=None):
if ( if (
color != Colorspace.RGBA color != Colorspace.RGBA
and color != Colorspace.LA and color != Colorspace.LA
and color != Colorspace.PA
and "transparency" not in imgdata.info and "transparency" not in imgdata.info
): ):
pngidat, palette = parse_png(rawdata) pngidat, palette = parse_png(rawdata)
@ -1783,6 +1784,7 @@ def read_images(rawdata, colorspace, first_frame_only=False, rot=None):
if ( if (
color == Colorspace.RGBA color == Colorspace.RGBA
or color == Colorspace.LA or color == Colorspace.LA
or color == Colorspace.PA
or "transparency" in newimg.info or "transparency" in newimg.info
): ):
if color == Colorspace.RGBA: if color == Colorspace.RGBA: