This commit is contained in:
Kovid Goyal 2021-02-03 19:29:46 +05:30
parent d3489712a6
commit 55d0e23c38
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -42,6 +42,7 @@ class Frame:
canvas_x: int
canvas_y: int
mode: str
needs_blend: bool
path: str = ''
def __init__(self, identify_data: Union['Frame', Dict[str, str]]):
@ -56,7 +57,9 @@ class Frame:
self.width, self.height = map(positive_int, identify_data['size'].split('x', 1))
self.xdpi, self.ydpi = map(positive_float, identify_data['dpi'].split('x', 1))
self.index = positive_int(identify_data['index'])
self.mode = 'rgba' if identify_data['transparency'].lower() in ('blend', 'true') else 'rgb'
q = identify_data['transparency'].lower()
self.mode = 'rgba' if q in ('blend', 'true') else 'rgb'
self.needs_blend = q == 'blend'
def __repr__(self) -> str:
canvas = f'{self.canvas_width}x{self.canvas_height}:{self.canvas_x}+{self.canvas_y}'