skip to navigation
skip to content

tinypng 2.1.4

Access from the shell and python scripts

Python module and command line tool for

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 or Voormedia B.V.

Important: You require an API key which you may obtain from

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 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(

shrink_info == {
    "output": {
        "type": "image/png",
        "filepath": "/path/your_input_file.png",
        "size": 36988,
        "ratio": 0.8279,
        "url": ""
    "url": "",
    "compression_count": "123",
    "input": {
        "type": "image/png",
        "size": 44679
File Type Py Version Uploaded on Size
tinypng-2.1.4-py2.py3-none-any.whl (md5) Python Wheel 2.7 2015-04-19 7KB
tinypng-2.1.4.tar.gz (md5) Source 2015-04-19 5KB (md5) Source 2015-01-25 10KB
  • Downloads (All Versions):
  • 73 downloads in the last day
  • 452 downloads in the last week
  • 1754 downloads in the last month