<commit_before>TinyPNG API
-----------

Python module and command line tool for [tinypng.com][1]

Shrink PNG files. Advanced lossy compression for PNG images
that preserves full alpha transparency.

Note: This project is not affiliated with [tinypng.com][1] or [Voormedia B.V.][2]

Important: You require an API key which you may obtain from
[tinypng.com/developers][3].


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


[1]: https://tinypng.com
[2]: http://voormedia.com/
[3]: https://tinypng.com/developers<commit_msg>update docs<commit_after>## TinyPNG API

Python module and command line tool for [tinypng.com][1]

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][1]
or [Voormedia B.V.][2]

Important: You require an API key which you may obtain from
[tinypng.com/developers][3].

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


[1]: https://tinypng.com
[2]: http://voormedia.com/
[3]: https://tinypng.com/developers
{'fraction_non_alphanumeric': 0.11394712853236098, 'fraction_numerical': 0.022789425706472195, 'mean_word_length': 3.149338374291115, 'pattern_counts': {'":': 11, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1494789', 'n_tokens_mistral': 770, 'n_tokens_neox': 704, 'n_words': 218}