scardine / image_size

Get image width and height given a file path using minimal dependencies (no need for PIL, libjpeg, libpng, etc)
MIT License
153 stars 45 forks source link

fails for some files (e.g. png) on Windows #3

Closed gityhup closed 8 years ago

gityhup commented 9 years ago

PNG files, for example, will have "data" truncated to "89:50:4e:47:0a", causing them to be misdetected as an (invalid) ICO file.

Changing

with open(file_path) as input:

to

with open(file_path, 'rb') as input:

solves this on this OS that does not treat binary and text files differently.

scardine commented 8 years ago

Thanks, fixed.