This web application helps you work with images by allowing you to extract main colors, crop, resize, adjust dimensions, and more.
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-devLinux:
./run-dev.shAlternatively, you can use the Visual Studio Code devcontainer for an easier setup.
For production, ensure Docker is installed on your machine. Then, run the following command:
Windows:
.\buildLinux:
./build.shThis 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.
The UI is built with JSF and offers a simple web interface where users can upload images and perform various operations using backend 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.
Note
- The notation
<api-version>refers to the version of the API. For example,v1, always start withv. - The notation
-Frefers to form data. - The notation
<value:default>refers to the default value of the parameter.
-
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
nmain colors from the image.
-
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.
-
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.
-
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.