removed imghdr dependency
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
"""
|
||||
import bz2
|
||||
import hashlib
|
||||
import imghdr
|
||||
import os
|
||||
import zlib
|
||||
import warnings
|
||||
@@ -429,8 +428,7 @@ class ImageEncoding(IntEnum):
|
||||
|
||||
@classmethod
|
||||
def encodingof(cls, imagebytes):
|
||||
type = imghdr.what(None, h=imagebytes)
|
||||
if type == 'jpeg':
|
||||
if imagebytes[6:10] in (b'JFIF', b'Exif') or imagebytes[:4] == b'\xff\xd8\xff\xdb':
|
||||
return ImageEncoding.JPEG
|
||||
return ImageEncoding.Unknown # pragma: no cover
|
||||
|
||||
|
||||
Reference in New Issue
Block a user