Socket
Socket
Sign inDemoInstall

tinypng

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinypng

Access api.tinypng.org from the shell and python scripts


Maintainers
1

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

.. _tinypng.com: https://tinypng.com
.. _Voormedia B.V.: http://voormedia.com/
.. _tinypng.com/developers: https://tinypng.com/developers

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc