diff --git a/labelImg.py b/labelImg.py index cc9edd9c9..bc13d553c 100755 --- a/labelImg.py +++ b/labelImg.py @@ -13,7 +13,7 @@ from functools import partial from collections import defaultdict - +import imghdr try: from PyQt5.QtGui import * from PyQt5.QtCore import * @@ -1091,6 +1091,11 @@ def load_file(self, file_path=None): image = self.image_data else: image = QImage.fromData(self.image_data) + # neglect images type + if image.isNull(): + image = QImage(unicode_file_path, imghdr.what(unicode_file_path)) + self.image_data = image + if image.isNull(): self.error_message(u'Error opening file', u"
Make sure %s is a valid image file." % unicode_file_path)