Skip to content

Commit

Permalink
Workaround for arsenetar#630
Browse files Browse the repository at this point in the history
* In some cases, the function dump_IFD() in core/pe/exif.py assigns a string instead of an int as "values".
* This value is then used as _cached_orientation in core/pe/photo.py in _get_orientation().
* The method _plat_get_blocks() in qt/pe/photo.py was only expecting an integer for the orientation argument, so we work around the issue for now by ignoring the value if it's a string.
  • Loading branch information
glubsy committed Aug 5, 2020
1 parent ab402d4 commit 6e81042
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qt/pe/photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def _plat_get_dimensions(self):
def _plat_get_blocks(self, block_count_per_side, orientation):
image = QImage(str(self.path))
image = image.convertToFormat(QImage.Format_RGB888)
if type(orientation) == str:
logging.warning("Orientation for file '%s' was a str '%s', not an int!",
str(self.path), orientation)
return getblocks(image, block_count_per_side)
# MYSTERY TO SOLVE: For reasons I cannot explain, orientations 5 and 7 don't work for
# duplicate scanning. The transforms seems to work fine (if I try to save the image after
# the transform, we see that the image has been correctly flipped and rotated), but the
Expand Down

0 comments on commit 6e81042

Please sign in to comment.