Get Image size WITHOUT loading image into memory
If you don’t care about the image contents, PIL is probably an overkill. I suggest parsing the output of the python magic module: >>> t = magic.from_file(‘teste.png’) >>> t ‘PNG image data, 782 x 602, 8-bit/color RGBA, non-interlaced’ >>> re.search(‘(\d+) x (\d+)’, t).groups() (‘782’, ‘602’) This is a wrapper around libmagic which read as few … Read more