Skip to content

martindotpy/image-coffee-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

116 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Coffee Utils

Banner

This web application helps you work with images by allowing you to extract main colors, crop, resize, adjust dimensions, and more.

How to Run

Development

To set up a development environment, you will need Java 21, Python 3.12 and .NET 8.0 installed on your machine. Then, run the following command:

Windows:

.\run-dev

Linux:

./run-dev.sh

Alternatively, you can use the Visual Studio Code devcontainer for an easier setup.

Production

For production, ensure Docker is installed on your machine. Then, run the following command:

Windows:

.\build

Linux:

./build.sh

This command will build the Docker images of Spring Microservices (Docker Compose will build the Python and C# image) and run the application using Docker Compose.

User Interface (UI)

The UI is built with JSF and offers a simple web interface where users can upload images and perform various operations using backend microservices.

Microservices

The backend uses Spring Cloud to deliver scalable services, including:

Service Technology Endpoint Example OpenAPI Docs
Colors Python (FastAPI) /api/<api-version>/colors api/v0/colors/docs
Crop C# (ASP.NET) /api/<api-version>/crop api/v0/crop/docs
Resize Java (Spring) /api/<api-version>/resize api/v0/resize/docs
Invert Colors Java (Spring) /api/<api-version>/invert-colors api/v0/invert-colors/docs

Each service processes images based on specific operations such as resizing, cropping, or color inversion.

Endpoint Parameters

Note

  • The notation <api-version> refers to the version of the API. For example, v1, always start with v.
  • The notation -F refers to form data.
  • The notation <value:default> refers to the default value of the parameter.

Colors

  • Endpoint: /api/<api-version>/colors

  • Method: POST

  • Parameters:

    • -F image=<image>: The image file to process.
    • -F n=<number_of_colors:5>: Number of colors to extract (default is 5).

    Extracts the n main colors from the image.

Crop

  • Endpoint: /api/<api-version>/crop

  • Method: POST

  • Parameters:

    • -F image=<image>: The image file to crop.
    • -F x=<x>: X coordinate for the top-left corner of the crop.
    • -F y=<y>: Y coordinate for the top-left corner of the crop.
    • -F width=<width:image-width>: The width of the cropped area.
    • -F height=<height:image-height>: The height of the cropped area.

    Crops the image based on the specified coordinates and dimensions.

Resize

  • Endpoint: /api/<api-version>/resize

  • Method: POST

  • Parameters:

    • -F image=<image>: The image file to resize.
    • -F width=<width>: The new width of the image.
    • -F height=<height>: The new height of the image.

    Resizes the image to the specified dimensions.

Invert Colors

  • Endpoint: /api/<api-version>/invert-colors

  • Method: POST

  • Parameters:

    • -F image=<image>: The image file whose colors will be inverted.

    Inverts the colors of the provided image.

About

Web application for using image utilities.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •