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

Issue with phone captured images #14

Open lvaleriu opened 3 years ago

lvaleriu commented 3 years ago

For some images (mainly the ones taken with a phone) the library inverts height and width dimensions. For the attached image (which is a landscape image of a document)

Image(path=Path('test.jpg'), type='JPEG', file_size=321819, width=747, height=1080)

cv2.imread('test.jpg')).shape returns (747, 1080, 3) # height, width, channels.

(We get the same value as opencv when using skimage imread).

test