How can I obtain the image size using a standard Python class (without using an external library)?
Here’s a Python 3 script that returns a tuple containing an image height and width for .png, .gif and .jpeg without using any external libraries (i.e., what Kurt McKee referenced). It should be relatively easy to transfer it to Python 2. import struct import imghdr def get_image_size(fname): ”’Determine the image type of fhandle and return its … Read more