diff --git a/src/calibre/utils/img.py b/src/calibre/utils/img.py index d45882b399..350ef29549 100644 --- a/src/calibre/utils/img.py +++ b/src/calibre/utils/img.py @@ -4,12 +4,11 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -from future_builtins import map import os, subprocess, errno, shutil, tempfile, sys from io import BytesIO from threading import Thread -from PyQt5.Qt import QImage, QByteArray, QBuffer, Qt, QImageReader, QColor, QImageWriter, QTransform, QCoreApplication, QProcessEnvironment +from PyQt5.Qt import QImage, QByteArray, QBuffer, Qt, QImageReader, QColor, QImageWriter, QTransform, QCoreApplication from calibre import fit_image, force_unicode from calibre.constants import iswindows, plugins, get_version @@ -19,13 +18,8 @@ from calibre.utils.filenames import atomic_rename # Ensure that Qt can load the imageformat plugins if QCoreApplication.instance() is None: - # Normally constructing a QCoreApplication takes care of this, but if we - # are being used without a QCoreApplication, then we have to do it manually - if len(set(b'jpeg gif png'.split(b' ')).intersection(set(map(bytes, QImageReader.supportedImageFormats())))) != 3: - qpp = QProcessEnvironment.systemEnvironment().value('QT_PLUGIN_PATH') - if qpp: - for path in qpp.split(os.pathsep): - QCoreApplication.addLibraryPath(path) + # We need a QCoreApplication() in order to load imageformat plugins + _core_app = QCoreApplication() # Utilities {{{ imageops, imageops_err = plugins['imageops']