From d919942f8e2f84a597f96139636d44cefbd4896a Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 22 Sep 2023 18:36:52 +1000 Subject: [PATCH] Last trailer comment has priority --- Tests/images/zero_bb_trailer.eps | 1 + src/PIL/EpsImagePlugin.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/images/zero_bb_trailer.eps b/Tests/images/zero_bb_trailer.eps index 84ee7829c44..964889965fe 100644 --- a/Tests/images/zero_bb_trailer.eps +++ b/Tests/images/zero_bb_trailer.eps @@ -1489,5 +1489,6 @@ grestore end showpage %%Trailer +%%BoundingBox: 0 0 400 300 %%BoundingBox: 0 0 460 352 %%DocumentFonts: Helvetica diff --git a/src/PIL/EpsImagePlugin.py b/src/PIL/EpsImagePlugin.py index fcc2463b8e6..95af6254061 100644 --- a/src/PIL/EpsImagePlugin.py +++ b/src/PIL/EpsImagePlugin.py @@ -259,7 +259,7 @@ def _read_comment(s): if k == "BoundingBox": if v == "(atend)": reading_trailer_comments = True - elif not self._size: + elif not self._size or reading_trailer_comments: try: # Note: The DSC spec says that BoundingBox # fields should be integers, but some drivers