Skip to content

Commit

Permalink
If DPI isn't in JPEG header, fetch from EXIF
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Mar 14, 2017
1 parent 92acfca commit 07a9620
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions PIL/JpegImagePlugin.py
Expand Up @@ -117,6 +117,11 @@ def APP(self, marker):
# plus constant header size
self.info["mpoffset"] = self.fp.tell() - n + 4

# If DPI isn't in JPEG header, fetch from EXIF
if "dpi" not in self.info and "exif" in self.info:
x_resolution = self._getexif()[0x011A]
self.info["dpi"] = x_resolution[0] / x_resolution[1]


def COM(self, marker):
#
Expand Down

0 comments on commit 07a9620

Please sign in to comment.