
You can pass an image file as buffer or image URL instead of an image file path. Get file names by `glob` and pass image files to TinyPng API with om_file method. create an src for source images and dist for optimized images. Install pip package pip install tinify Step3.

Go to and type your name and email address. In this post, I will show you how to use the API with python. The great thing is that TinyPNG has API and packages for multiple languages. That is useful but we sometimes need to compress more than 20 images. TinyPNG has a web app that allows us to compress images(up to 20 images & max 5MB each). The effect is nearly invisible but it makes a very large difference in file size! By selectively decreasing the number of colors in the image, fewer bytes are required to store the data. >TinyPNG uses smart lossy compression techniques to reduce the file size of your WEBP, JPEG, and PNG files. Compress images with 16 lines of python code and TinyPNG API What is TinyPNG?
