Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mbarkhau/tinypng
Python module and command line tool for tinypng.com
https://github.com/mbarkhau/tinypng
Last synced: about 1 month ago
JSON representation
Python module and command line tool for tinypng.com
- Host: GitHub
- URL: https://github.com/mbarkhau/tinypng
- Owner: mbarkhau
- License: bsd-2-clause
- Created: 2015-01-25T17:46:08.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-07T16:27:36.000Z (about 8 years ago)
- Last Synced: 2024-10-03T16:32:18.707Z (about 2 months ago)
- Language: Python
- Size: 28.3 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
TinyPNG API
-----------Python module and command line tool for `tinypng.com`_
Shrink PNG files. Advanced lossy compression for PNG images that
preserves full alpha transparency. Now also works with JPEG files.Note: This project is not affiliated with `tinypng.com`_ or `Voormedia
B.V.`_Important: You require an API key which you may obtain from
`tinypng.com/developers`_.Besides specifying keys via command line arguments you can:
1. Set the environment variable TINYPNG\_API\_KEY
2. Create a .tinypng.keys file in your home directory
3. Create a tinypng.keys file in the current directoryProgramatic api
~~~~~~~~~~~~~~~::
from tinypng import api
# implicitly writes to "your_file.tiny.png"
shrink_info = api.shrink_file("your_file.png", api_key='your_key_here')shrink_info = api.shrink_file(
"your_input_file.png",
api_key='your_key_here',
out_filepath="your_output_file.png"
)shrink_info == {
"output": {
"type": "image/png",
"filepath": "/path/your_input_file.png",
"size": 36988,
"ratio": 0.8279,
"url": "https://api.tinypng.com/output/abcdefg123456.jpg"
},
"url": "https://api.tinypng.com/output/abcdefg123456.jpg",
"compression_count": "123",
"input": {
"type": "image/png",
"size": 44679
}
}.. _tinypng.com: https://tinypng.com
.. _Voormedia B.V.: http://voormedia.com/
.. _tinypng.com/developers: https://tinypng.com/developers