This service processes images with various transformations such as blur, crop, resize, grayscale, and invert. It uses RabbitMQ for message queuing and Docker Compose for container orchestration.
This is a work in progress and may be missing some validations and error handling.
The ImageProcess endpoint accepts the following parameters:
- files: Multipart file upload.
- blur: A string representing the blur intensity.
- crop_anchor: A string representing the crop dimensions in the format
width,height. - resize: A string representing the resize dimensions in the format
width,height. - grayscale: A string (any non-empty value will apply grayscale).
- invert: A string (any non-empty value will apply invert).
- ... More processes soon
To run the service using Docker Compose, follow these steps:
- Ensure Docker and Docker Compose are installed on your machine.
- Clone the repository:
git clone https://github.com/offerni/imagenaerum.git cd imagenaerum - Start the RabbitMQ container:
docker-compose up --build
To start the worker and consumer servers, run the following commands in separate terminals:
-
Start the worker server:
cd worker cp .env.default .env go run cmd/main.go -
Start the consumer server:
cd consumer cp .env.default .env go run cmd/main.go
- POST /image_process
- Description: Processes images with the specified transformations.
- Parameters:
blur: Optional. Blur intensity.crop_anchor: Optional. Crop dimensions inwidth,height.resize: Optional. Resize dimensions inwidth,height.grayscale: Optional. Apply grayscale.invert: Optional. Apply invert.files: Required. Multipart file upload.
- Example:
curl -X POST http://localhost:8080/image_process \ -F "files=@/path/to/image.jpg" \ -F "blur=2.5" \ -F "crop_anchor=100,100" \ -F "resize=200,200" \ -F "grayscale=true" \ -F "invert=true"
- GET /image/{id}
- Description: Retrieves the processed image by its ID.
- Parameters:
id: Required. The ID of the processed image.
- Example:
curl -X GET http://localhost:8080/image/2d3a1b0e-11a7-4bde-8a1b-c83a29a1c653.jpg