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
|
- Fix a regression that caused :option:`kitty --title` to not work when
|
||||||
opening new OS windows using :option:`kitty --single-instance` (:iss:`3893`)
|
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]
|
0.23.1 [2021-08-17]
|
||||||
----------------------
|
----------------------
|
||||||
|
|||||||
@ -52,6 +52,7 @@ class Frame:
|
|||||||
canvas_y: int
|
canvas_y: int
|
||||||
mode: str
|
mode: str
|
||||||
needs_blend: bool
|
needs_blend: bool
|
||||||
|
dimensions_swapped: bool
|
||||||
dispose: Dispose
|
dispose: Dispose
|
||||||
path: str = ''
|
path: str = ''
|
||||||
|
|
||||||
@ -71,6 +72,12 @@ class Frame:
|
|||||||
self.mode = 'rgba' if q in ('blend', 'true') else 'rgb'
|
self.mode = 'rgba' if q in ('blend', 'true') else 'rgb'
|
||||||
self.needs_blend = q == 'blend'
|
self.needs_blend = q == 'blend'
|
||||||
self.dispose = getattr(Dispose, identify_data['dispose'].lower())
|
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:
|
def __repr__(self) -> str:
|
||||||
canvas = f'{self.canvas_width}x{self.canvas_height}:{self.canvas_x}+{self.canvas_y}'
|
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:
|
def identify(path: str) -> ImageData:
|
||||||
import json
|
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')
|
exe = find_exe('magick')
|
||||||
if exe:
|
if exe:
|
||||||
cmd = [exe, 'identify']
|
cmd = [exe, 'identify']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user