icat kitten: Fix display of JPEG images that are rotated via EXIF data and larger than available screen size
Fixes #3949
This commit is contained in:
parent
59c14d07fd
commit
34ec3eac44
@ -21,6 +21,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
- Fix a regression that caused :option:`kitty --title` to not work when
|
||||
opening new OS windows using :option:`kitty --single-instance` (:iss:`3893`)
|
||||
|
||||
- icat kitten: Fix display of JPEG images that are rotated via EXIF data and
|
||||
larger than available screen size (:iss:`3949`)
|
||||
|
||||
|
||||
0.23.1 [2021-08-17]
|
||||
----------------------
|
||||
|
||||
@ -52,6 +52,7 @@ class Frame:
|
||||
canvas_y: int
|
||||
mode: str
|
||||
needs_blend: bool
|
||||
dimensions_swapped: bool
|
||||
dispose: Dispose
|
||||
path: str = ''
|
||||
|
||||
@ -71,6 +72,12 @@ class Frame:
|
||||
self.mode = 'rgba' if q in ('blend', 'true') else 'rgb'
|
||||
self.needs_blend = q == 'blend'
|
||||
self.dispose = getattr(Dispose, identify_data['dispose'].lower())
|
||||
if identify_data.get('orientation') in ('5', '6', '7', '8'):
|
||||
self.canvas_width, self.canvas_height = self.canvas_height, self.canvas_width
|
||||
self.width, self.height = self.height, self.width
|
||||
self.dimensions_swapped = True
|
||||
else:
|
||||
self.dimensions_swapped = False
|
||||
|
||||
def __repr__(self) -> str:
|
||||
canvas = f'{self.canvas_width}x{self.canvas_height}:{self.canvas_x}+{self.canvas_y}'
|
||||
@ -143,7 +150,7 @@ def run_imagemagick(path: str, cmd: Sequence[str], keep_stdout: bool = True) ->
|
||||
|
||||
def identify(path: str) -> ImageData:
|
||||
import json
|
||||
q = '{"fmt":"%m","canvas":"%g","transparency":"%A","gap":"%T","index":"%p","size":"%wx%h","dpi":"%xx%y","dispose":"%D"},'
|
||||
q = '{"fmt":"%m","canvas":"%g","transparency":"%A","gap":"%T","index":"%p","size":"%wx%h","dpi":"%xx%y","dispose":"%D","orientation":"%[EXIF:Orientation]"}'
|
||||
exe = find_exe('magick')
|
||||
if exe:
|
||||
cmd = [exe, 'identify']
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user