1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Removed dependencies on PIL. Man, I wish I had known about QImageReader sooner... That was a little stupid on my part not to look further than QImage.

This commit is contained in:
Virgil Dupras
2010-08-17 09:38:58 +02:00
parent e2f240ebc9
commit 89409c22d1
4 changed files with 12 additions and 8 deletions

View File

@@ -9,8 +9,7 @@
import os.path as op
import logging
from PyQt4.QtGui import QImage
import PIL.Image
from PyQt4.QtGui import QImage, QImageReader
from hsutil.str import get_file_ext
@@ -41,9 +40,13 @@ class File(fs.File):
fs.File._read_info(self, field)
if field == 'dimensions':
try:
im = PIL.Image.open(str(self.path))
self.dimensions = im.size
except IOError:
ir = QImageReader(str(self.path))
size = ir.size()
if size.isValid():
self.dimensions = (size.width(), size.height())
else:
self.dimensions = (0, 0)
except EnvironmentError:
self.dimensions = (0, 0)
logging.warning("Could not read image '%s'", str(self.path))

View File

@@ -6,6 +6,8 @@
# http://www.hardcoded.net/licenses/hs_license
import sys
import sip
sip.setapi('QVariant', 1)
from PyQt4.QtCore import QCoreApplication
from PyQt4.QtGui import QApplication, QIcon, QPixmap
@@ -16,8 +18,6 @@ from app import DupeGuru
if sys.platform == 'win32':
import base.cxfreeze_fix
# This is a workaround for a cxfreeze problem where compiled dupeguru can't read tiff files
from PIL import TiffImagePlugin, TiffTags
if __name__ == "__main__":
app = QApplication(sys.argv)