Access api.tinypng.org from the shell and python scripts
Project description
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:
Set the environment variable TINYPNG_API_KEY
Create a .tinypng.keys file in your home directory
Create a tinypng.keys file in the current directory
Programatic api
from tinypng import shrink_file # implicitly writes to "your_file.tiny.png" shrink_info = shrink_file("your_file.png", api_key='your_key_here') shrink_info = 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 } }
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
tinypng-2.1.3.zip
(10.7 kB
view hashes)
tinypng-2.1.3.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for tinypng-2.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25c1cea58100c51c121b27241e5cd8877478cb2829b5ecd981fbd7de8add4756 |
|
MD5 | 1ebb8965fbaedccb0d6e175e30366ec7 |
|
BLAKE2b-256 | 110db401f930e0fd920aab558ffe34ef0c9c5caedba64ad23780253c1967b2c2 |