Skip to content

Commit

Permalink
added support for webp files
Browse files Browse the repository at this point in the history
  • Loading branch information
ExtReMLapin authored Apr 29, 2022
1 parent 731a148 commit b214d05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions imagesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ def get(filepath):

fhandle.seek(-1, os.SEEK_CUR)
width, height = sizes
elif head.startswith(b"RIFF") and head[8:12] == b"WEBP":
# enter VP8 chunk
fhandle.seek(26)
width = struct.unpack("<H", fhandle.read(2))[0]
height = struct.unpack("<H", fhandle.read(2))[0]

finally:
fhandle.close()
Expand Down

0 comments on commit b214d05

Please sign in to comment.