mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-28 05:54:12 +03:00
Handle rational tags with a zero denominator
This commit is contained in:
parent
11c654c187
commit
c2ada0cac8
BIN
Tests/images/exif_gps_zero_denominator.jpg
Normal file
BIN
Tests/images/exif_gps_zero_denominator.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 411 B |
|
@ -406,6 +406,10 @@ class TestFileJpeg:
|
|||
# Should not raise a TypeError
|
||||
im._getexif()
|
||||
|
||||
def test_exif_gps_zero_denominator(self) -> None:
|
||||
with Image.open("Tests/images/exif_gps_zero_denominator.jpg") as im:
|
||||
im.getexif().tobytes()
|
||||
|
||||
def test_progressive_compat(self) -> None:
|
||||
im1 = self.roundtrip(hopper())
|
||||
assert not im1.info.get("progressive")
|
||||
|
|
|
@ -294,7 +294,7 @@ def _accept(prefix: bytes) -> bool:
|
|||
def _limit_rational(
|
||||
val: float | Fraction | IFDRational, max_val: int
|
||||
) -> tuple[IntegralLike, IntegralLike]:
|
||||
inv = abs(float(val)) > 1
|
||||
inv = abs(val) > 1
|
||||
n_d = IFDRational(1 / val if inv else val).limit_rational(max_val)
|
||||
return n_d[::-1] if inv else n_d
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user