From 12d8b439d5108c1c9acba9bcc15bf2a46c4ee59b Mon Sep 17 00:00:00 2001 From: nopperl <54780682+nopperl@users.noreply.github.com> Date: Thu, 7 Sep 2023 20:20:35 +0200 Subject: [PATCH] Read bounding box information from the trailer of EPS files if specified --- Tests/images/zero_bb_trailer.eps | Bin 0 -> 26382 bytes Tests/test_file_eps.py | 11 ++++++ src/PIL/EpsImagePlugin.py | 66 +++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 Tests/images/zero_bb_trailer.eps diff --git a/Tests/images/zero_bb_trailer.eps b/Tests/images/zero_bb_trailer.eps new file mode 100644 index 0000000000000000000000000000000000000000..84ee7829c44703799b479c874c8d75ba7c1f46a4 GIT binary patch literal 26382 zcmcItdvDvumjB!Q6th?uaQ0R~?Rps{!ap2}^)#8?FT>B_Qh4c@MYKAdCIJ6eI2XT0pM`RT z>%LarYw6-z(!kSbwtWa!$(v}E#IMBx#;@kD@ZvbyuI7u?-Es8Qe*E)leiA(p1d(za z-Yr%an`jx`IY%I8zL+IK1w+9X^YGS5AKuVNXW!Wu*Y}~gjh4&k3uYI|W*Z*ePM0wr zE~j^~c$hwln^1)FMFOgC9>x81H5ZFpF%RR#CY&FdDYmOcB9@C)D84M_$-SUacbn;B zJew{CW|;Vn=W~uuz`=%T0h(Lq=y*AueM-Ww ziO{6+!>eeynA;Cdr!hpnx&wBp;m$w>2v~y|W{Kg>NGsBQa!IlUch;bj&_v_^UgeMOJ&C}=NE#3+q!3^W2-~pQbXa?mnNmVVAT!esz;K27HaOvNN=yRAv z!iSgQjznSZJXfW+cwybmmQfti3_Kg5!-XXi^1HVtT4;9_@54<@Ed^OiS{?hVcuECP1^Hj` zlyPYzI1x{Am~8HDX5_>6o7)VDxLqul_NzMvqHtk9eH-6LU+@M$*_5D|eQ~bi5h71` z3r)<$5+QOU7AuiZAX~r~p`92W8f_Bs?)uGO3=dc*iY!1VHeD7E%tMil*w4;1Mq~8r zXt7E}oNS^`p*V-38%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