imageprobe 0.3.0
imageprobe
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.