Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nkanaev/imgspy
imgspy finds the metadata (type, size) of an image given its url by fetching as little as needed
https://github.com/nkanaev/imgspy
Last synced: 20 days ago
JSON representation
imgspy finds the metadata (type, size) of an image given its url by fetching as little as needed
- Host: GitHub
- URL: https://github.com/nkanaev/imgspy
- Owner: nkanaev
- License: mit
- Created: 2017-07-02T18:29:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-15T20:13:10.000Z (about 4 years ago)
- Last Synced: 2024-09-19T10:08:35.892Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 192 KB
- Stars: 54
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.rst
- License: license
Awesome Lists containing this project
- starred-awesome - imgspy - imgspy finds the metadata (type, size) of an image given its url by fetching as little as needed (Python)
README
imgspy
======imgspy finds the metadata (type, size) of an image given its url by fetching as little as needed. This is a python implementation of `fastimage`_. Supports image types BMP, CUR, GIF, ICO, JPEG, PNG, PSD, TIFF, WEBP.
.. _fastimage: https://github.com/sdsykes/fastimage
usage
-----::
>>> imgspy.info('http://via.placeholder.com/1920x1080')
{'type': 'png', 'width': 1920, 'height': 1080}
>>> with requests.get('http://via.placeholder.com/1920x1080', stream=True) as res:
... imgspy.info(res.raw)
{'type': 'png', 'width': 1920, 'height': 1080}
>>> imgspy.info('/path/to/image.jpg')
{'type': 'jpg', 'width': 420, 'height': 240}
>>> with open('/path/to/image.jpg') as f:
... imgspy.info(f)
{'type': 'jpg', 'width': 420, 'height': 240}.. image:: https://github.com/nkanaev/imgspy/workflows/test/badge.svg
:target: https://github.com/nkanaev/imgspy/actions