Compare commits

..

2 commits

View file

@ -1312,13 +1312,10 @@ def get_imgmetadata(
imgwidthpx, imgheightpx = imgdata.size imgwidthpx, imgheightpx = imgdata.size
ndpi = imgdata.info.get("dpi") ndpi = imgdata.info.get("dpi")
if ndpi is None:
# the PNG plugin of PIL adds the undocumented "aspect" field instead of # the PNG plugin of PIL adds the undocumented "aspect" field instead of
# the "dpi" field if the PNG pHYs chunk unit is not set to meters # the "dpi" field if the PNG pHYs chunk unit is not set to meters
if ( if imgformat == ImageFormat.PNG and imgdata.info.get("aspect") is not None:
ndpi is None
and imgformat == ImageFormat.PNG
and imgdata.info.get("aspect") is not None
):
aspect = imgdata.info["aspect"] aspect = imgdata.info["aspect"]
# make sure not to go below the default dpi # make sure not to go below the default dpi
if aspect[0] > aspect[1]: if aspect[0] > aspect[1]: