Skip to main content

Asynchronous image probing library. Fetch only as much as you need!

Project description

imageprobe

Latest PyPI package version Supported Python versions Development status CI Codecov

Asynchronous library to get image dimensions by fetching as little data as possible.

It temporarily supports only GIF, PNG because development is still in a very early stage.

Usage

To install this library, run:

pip install imageprobe

The probe() function returns metadata of an image from an URL, or throws an exception if an error occurred.

import asyncio
from imageprobe import probe

url = "https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png"
image_data = asyncio.run(probe(url))
print(image_data.width, image_data.height)

# 172 178

Under the hood, probe() creates an aiohttp.ClientSession, but you can pass a pre-existing session as an optional argument if you prefer.

Contributing

I won't accept pull requests until the first beta release.

Project details


Download files

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

Source Distribution

imageprobe-0.3.0.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

imageprobe-0.3.0-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page