def get_image_dimensions(file_or_path):
    from PIL import ImageFile as PILImageFile
    p = PILImageFile.Parser()
    if hasattr(file_or_path, 'read'):
        file = file_or_path
    else:
        file = open(file_or_path, 'rb')
    while 1:
        data = file.read(1024)
        if not data:
            break
        p.feed(data)
        if p.image:
            return p.image.size
    return None
Converts the entity representation of this model to an instance.
dataset/ETHPy150Open dcramer/django-compositepks/django/core/files/images.py/get_image_dimensions--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/Model.from_entity