Skip to content

leonardosblang/python-compressed-image-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python API for compressing images

License: MIT

This repository contains an API for compressing and sending images using FastAPI written in Python. The API converts a selected image to webpm and them compresses it further by encoding it with base64, while also having the option to apply extra compression methods such as algorithms like zlib.

📊 Comparison

We compare the original image (in png and jpeg format) to the webp format, which is a modern image format that provides superior compression for image files while still maintaining quality.

Format PNG WEBP
Size 114KB 58KB
Format JPG Compressed WEBP
Size 14.7MB 791KB

(Normal files used for testing are in the images directory , compressed ones are in the results directory directory)

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

📋 Prerequisites

You will need to have Python 3.7+ installed.

🔧 Installing

Create a new virtual environment and activate it:

python -m venv venv
. venv/bin/activate

install dependencies with:

pip install -r requirements.txt

run api:

uvicorn main:app

📝 License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Made by Leonardo Lang

About

Testing different methods for compressing image files in python and them sending them via api.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages