def identify_data(data): ''' Identify the image in data. Returns a 3-tuple (width, height, format) or raises an Exception if data is not an image. ''' fmt, width, height = _identify(data) return width, height, fmt
def identify(path): ''' Identify the image at path. Returns a 3-tuple (width, height, format) or raises an Exception. ''' with lopen(path, 'rb') as f: fmt, width, height = _identify(f) return width, height, fmt