I found out how to use PIL to get the image dimensions, but not the file size in bytes. I need to know the file size to decide if the file is too big to be uploaded to the database.
Try:
import os print os.stat('somefile.ext').st_size