summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames R. Barlow <jim@purplerock.ca>2019-04-13 23:56:46 -0700
committerJames R. Barlow <jim@purplerock.ca>2019-04-13 23:56:46 -0700
commit6d54a421cacce58a0899a3a4dad78bbd35d0017d (patch)
treeaf01f5a279c9e349de8ad4c1190f8b6663a2b310
parentae4be6496abdc35573904f2a82e601e96651bef3 (diff)
image: fix IndexError if /DecodeParms are missing
-rw-r--r--src/pikepdf/models/image.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pikepdf/models/image.py b/src/pikepdf/models/image.py
index 5f80258..0bef94b 100644
--- a/src/pikepdf/models/image.py
+++ b/src/pikepdf/models/image.py
@@ -301,14 +301,14 @@ class PdfImage(PdfImageBase):
# be saved as JPEGs, and are probably bugs. Some software in the
# wild actually produces RGB JPEGs in PDFs (probably a bug).
DEFAULT_CT_RGB = 1
- ct = self.decode_parms[0].get('/ColorTransform', DEFAULT_CT_RGB)
+ ct = self.filter_decodeparms[0][1].get('/ColorTransform', DEFAULT_CT_RGB)
return self.mode == 'RGB' and ct == DEFAULT_CT_RGB
def normal_dct_cmyk():
# Normal DCTDecode CMYKs have /ColorTransform 0 and can be saved.
# There is a YUVK colorspace but CMYK JPEGs don't generally use it
DEFAULT_CT_CMYK = 0
- ct = self.decode_parms[0].get('/ColorTransform', DEFAULT_CT_CMYK)
+ ct = self.filter_decodeparms[0][1].get('/ColorTransform', DEFAULT_CT_CMYK)
return self.mode == 'CMYK' and ct == DEFAULT_CT_CMYK
if self.filters == ['/CCITTFaxDecode']: