Skip to content

Latest commit

 

History

History
73 lines (62 loc) · 3.82 KB

README.md

File metadata and controls

73 lines (62 loc) · 3.82 KB

Flask Image Converter

This is a test project created in 2024. Its purpose is to convert uploaded images to the WebP format using the Flask web framework and the Pillow library. This project also helped me learn continuous deployment using Docker, GitHub Actions, and Google Cloud Run. The image converter functionality is aimed at supporting other projects by efficiently handling image conversion needs without the needs of credits.

Technologies used

Getting started

To run this Flask image converter application locally, follow these steps: 1. Clone this repository

git clone https://github.com/your-username/flask-image-converter.git
cd flask-image-converter

2. Set up a virtual environment and install dependencies:

python3 -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt

3. Run the development server:

flask run

4. Open the application in your browser Visit http://localhost:5000 to access the image converter interface.

Using the Image Converter

Open the Application

Upload Images

  • Drag and Drop: Drag and drop image files into the drop zone area.
  • Select Files: Alternatively, click on the file input to select multiple image files from your file system. You can upload up to 5 images at a time, each with a maximum size of 20MB.

Select Format

Choose the desired format for conversion from the dropdown menu:

  • WebP
  • JPEG
  • PNG

Select Quality

Adjust the quality of the output images using the slider. The quality ranges from 1 (lowest) to 100 (highest). This option is available for WebP and JPEG formats. Convert Images

Click the Convert button to start the conversion process. Download the Results

If only one image is uploaded, the converted image will be downloaded automatically. If multiple images are uploaded, a ZIP file containing all converted images will be downloaded.

Error Handling

Rate Limiting: To prevent spam, the server limits requests to one every 5 seconds from the same IP address. File Size and Type Checks: Ensure each file is less than 20MB and is a valid image format (JPEG, PNG, WebP). Errors will be displayed if the constraints are not met.

Deployment

The application is designed to be deployed using Docker and managed through GitHub Actions for CI/CD. It can be easily deployed to Google Cloud Run for scalable, serverless deployment. (Not that it's meant to this was more of a test)

  • Docker: Containerize the application for consistent and isolated environments.
  • GitHub Actions: Automate the deployment pipeline.
  • Google Cloud Run: Run the application in a scalable, serverless environment.

Screenshots

image

Icons used

Badges4Readme - alexandresanlim