Skip to content

Commit f693a3a

Browse files
authored
Use plugin method directly when saving PDFs (#9547)
1 parent 6a05e34 commit f693a3a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/PIL/PdfImagePlugin.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,14 @@ def _write_image(
148148
strip_size=math.ceil(width / 8) * height,
149149
)
150150
elif decode_filter == "DCTDecode":
151-
Image.SAVE["JPEG"](im, op, filename)
151+
from . import JpegImagePlugin
152+
153+
JpegImagePlugin._save(im, op, filename)
152154
elif decode_filter == "JPXDecode":
155+
from . import Jpeg2KImagePlugin
156+
153157
del dict_obj["BitsPerComponent"]
154-
Image.SAVE["JPEG2000"](im, op, filename)
158+
Jpeg2KImagePlugin._save(im, op, filename)
155159
else:
156160
msg = f"unsupported PDF filter ({decode_filter})"
157161
raise ValueError(msg)

0 commit comments

Comments
 (0)