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

1
README
View File

@ -46,7 +46,6 @@ Windows prerequisites
- Visual Studio 2008 (Express is enough) is needed to build C extensions. (http://www.microsoft.com/Express/)
- PyQt 4.7 (http://www.riverbankcomputing.co.uk/news)
- Python Imaging Library for dupeGuru PE. (http://www.pythonware.com/products/pil/)
- cx_Freeze, if you want to build a exe. You don't need it if you just want to run dupeGuru. (http://cx-freeze.sourceforge.net/)
- Advanced Installer, if you want to build the installer file. (http://www.advancedinstaller.com/)

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

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)