Skip to main content

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

Installation

Install the latest imagefacts from PyPI:

$ pip install imagefacts
# or
$ easy_install imagefacts

Usage

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('http://example.com/image')  # URL
('image/png', 400, 476)
>>>

You can also use imagefacts from the command line:

$ python -m imagefacts http://example.com/image
('image/png', 400, 476)
$

Contributors

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

Download files

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

Source Distribution

imagefacts-1.1.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file imagefacts-1.1.tar.gz.

File metadata

  • Download URL: imagefacts-1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for imagefacts-1.1.tar.gz
Algorithm Hash digest
SHA256 bfc626e1056e6247f24320263ac22b78f54c087dc4bffd8a769d73d6cae73d44
MD5 a30d0ce02df23d30949f4fd41ba47cfc
BLAKE2b-256 16f2b1bf3a2ab475a3c08d4ecb8a02c47fc7083f27cb3f4b9cca113665229740

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1 This release

1 file

1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page