Skip to content

Instantly share code, notes, and snippets.

@qingswu
Last active July 8, 2016 09:12
Show Gist options
  • Save qingswu/845836fdb59408e9ef110786fd982f7b to your computer and use it in GitHub Desktop.
Save qingswu/845836fdb59408e9ef110786fd982f7b to your computer and use it in GitHub Desktop.
Get the minimum/maximum width/height of all the jpg images in current folder.
#!/usr/bin/env python
from glob import glob
import cv2
jpgs = glob('./*.jpg')
shapes = [cv2.imread(f).shape for f in jpgs]
a = [list(i) for i in shapes]
width = [row[1] for row in a]
height = [row[0] for row in a]
print 'width min:', min(width), ', max:', max(width), '; height min:', min(height), ', max:', max(height)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment