Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Find out the screen dimensions of the commonest image formats from a URL or bytestring

Project Description

imagefacts discovers the screen dimensions of the commonest image formats from a URL or a bytestring.


Install the latest imagefacts from PyPI:

$ pip install imagefacts
# or
$ easy_install imagefacts


Use the imagefacts.facts() function to find an image’s dimensions:

>>> import imagefacts
>>> imagefacts.facts(open('localfile.jpg').read())  # byte string
('image/jpeg', 1024, 768)
>>> imagefacts.facts(open('localfile.jpg'))  # file object
('image/jpeg', 1024, 768)
>>> imagefacts.facts('localfile.jpg')  # file name
('image/jpeg', 1024, 768)
>>> imagefacts.facts('')  # URL
('image/png', 400, 476)

You can also use imagefacts from the command line:

$ python -m imagefacts
('image/png', 400, 476)


Portions of imagefacts are from the feedparser project by Mark Pilgrim and bfg-pages by zutesmog. Thanks!

Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(4.9 kB) Copy SHA256 Hash SHA256
Source None Nov 15, 2011

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers