Commit 626b22ae authored by Manuel Günther's avatar Manuel Günther
Browse files

Hot-fixed weired imghdr issue with identfying jpegs

parent c3c2c9e9
......@@ -17,6 +17,12 @@ def get_config():
import bob.extension
return bob.extension.get_config(__name__, version.externals)
# fix imghdr's jpeg detection to use the first two bytes (according to
import imghdr
def _test_jpeg(h, f):
if h.startswith('\xff\xd8'):
return "jpeg"
def load(filename, extension=None):
"""load(filename) -> image
......@@ -48,8 +54,10 @@ def load(filename, extension=None):
f =, 'r')
if extension == 'auto':
import imghdr
extension = "." + imghdr.what(filename)
extension = imghdr.what(filename)
if extension is None:
raise IOError("Could not detect the image type of file %s" % filename)
extension = "." + extension
f =, 'r', extension)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment