mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Fix calls to supportedImageFormats()
This commit is contained in:
parent
e721f8aa3e
commit
eb10773b6f
@ -24,7 +24,7 @@ from polyglot.queue import Queue, Empty
|
|||||||
|
|
||||||
def image_extensions():
|
def image_extensions():
|
||||||
if not hasattr(image_extensions, 'ans'):
|
if not hasattr(image_extensions, 'ans'):
|
||||||
image_extensions.ans = [as_unicode_polyglot(x) for x in QImageReader.supportedImageFormats()]
|
image_extensions.ans = [x.data().decode('utf-8') for x in QImageReader.supportedImageFormats()]
|
||||||
return image_extensions.ans
|
return image_extensions.ans
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ from calibre.utils.img import (
|
|||||||
remove_borders_from_image, gaussian_sharpen_image, gaussian_blur_image, image_to_data, despeckle_image,
|
remove_borders_from_image, gaussian_sharpen_image, gaussian_blur_image, image_to_data, despeckle_image,
|
||||||
normalize_image, oil_paint_image
|
normalize_image, oil_paint_image
|
||||||
)
|
)
|
||||||
from polyglot.builtins import as_unicode
|
|
||||||
|
|
||||||
|
|
||||||
def painter(func):
|
def painter(func):
|
||||||
@ -325,7 +324,7 @@ class Canvas(QWidget):
|
|||||||
if not self.is_modified:
|
if not self.is_modified:
|
||||||
return self.original_image_data
|
return self.original_image_data
|
||||||
fmt = self.original_image_format or 'JPEG'
|
fmt = self.original_image_format or 'JPEG'
|
||||||
if fmt.lower() not in set(map(as_unicode, QImageWriter.supportedImageFormats())):
|
if fmt.lower() not in {x.data().decode('utf-8') for x in QImageWriter.supportedImageFormats()}:
|
||||||
if fmt.lower() == 'gif':
|
if fmt.lower() == 'gif':
|
||||||
data = image_to_data(self.current_image, fmt='PNG', png_compression_level=0)
|
data = image_to_data(self.current_image, fmt='PNG', png_compression_level=0)
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
Loading…
x
Reference in New Issue
Block a user