Fix icat for GIF images broken
This commit is contained in:
parent
e18ac4f0f5
commit
90f2ba474c
@ -147,14 +147,18 @@ 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","orientation":"%[EXIF:Orientation]"}'
|
q = (
|
||||||
|
'{"fmt":"%m","canvas":"%g","transparency":"%A","gap":"%T","index":"%p","size":"%wx%h",'
|
||||||
|
'"dpi":"%xx%y","dispose":"%D","orientation":"%[EXIF:Orientation]"},'
|
||||||
|
)
|
||||||
exe = which('magick')
|
exe = which('magick')
|
||||||
if exe:
|
if exe:
|
||||||
cmd = [exe, 'identify']
|
cmd = [exe, 'identify']
|
||||||
else:
|
else:
|
||||||
cmd = ['identify']
|
cmd = ['identify']
|
||||||
p = run_imagemagick(path, cmd + ['-format', q, '--', path])
|
p = run_imagemagick(path, cmd + ['-format', q, '--', path])
|
||||||
data = json.loads(b'[' + p.stdout.rstrip(b',') + b']')
|
raw = p.stdout.rstrip(b',')
|
||||||
|
data = json.loads(b'[' + raw + b']')
|
||||||
first = data[0]
|
first = data[0]
|
||||||
frames = list(map(Frame, data))
|
frames = list(map(Frame, data))
|
||||||
image_fmt = first['fmt'].lower()
|
image_fmt = first['fmt'].lower()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user