Image Processing

Six ImageMagick requests: resize, crop, rotate, filter, composite, and one transform entry point for all of them.

Resize

ImageMagick resizes to a width and height. By default the image keeps its aspect ratio and fits inside that box; turn maintain_aspect_ratio off to stretch it to the exact size.

Request json
1{
2  "id": "req-1",
3  "type": "image_resize",
4  "data": {
5    "image_path": "/srv/photos/street.jpg",
6    "parameters": {"width": 800, "height": 600}
7  }
8}
Response json
1{
2  "id": "req-1",
3  "success": true,
4  "message": "Image resize completed successfully",
5  "data": {
6    "transformed_image_path": "/tmp/mediaprocessor_…_resize.png",
7    "operation": "resize",
8    "original_dimensions": [2400, 1600],
9    "new_dimensions": [800, 533],
10    "format": "PNG",
11    "intensity": 1.0,
12    "background_color": "transparent"
13  }
14}

Crop

Cut out a region in source pixels: the top-left corner and a width and height. The response reports the original and new dimensions.

Request json
1{
2  "id": "req-1",
3  "type": "image_crop",
4  "data": {
5    "image_path": "/srv/photos/street.jpg",
6    "parameters": {"x": 100, "y": 50, "width": 500, "height": 400}
7  }
8}
Response json
1{
2  "id": "req-1",
3  "success": true,
4  "message": "Image crop completed successfully",
5  "data": {
6    "transformed_image_path": "/tmp/mediaprocessor_…_crop.png",
7    "operation": "crop",
8    "original_dimensions": [2400, 1600],
9    "new_dimensions": [500, 400],
10    "format": "PNG",
11    "intensity": 1.0,
12    "background_color": "transparent"
13  }
14}

Rotate

Rotate by any angle, clockwise. The canvas grows to hold the whole rotated image, and the corners it exposes are filled with a colour you choose (transparent by default).

Request json
1{
2  "id": "req-1",
3  "type": "image_rotate",
4  "data": {
5    "image_path": "/srv/photos/street.jpg",
6    "parameters": {"angle": 90, "background_color": "transparent"}
7  }
8}
Response json
1{
2  "id": "req-1",
3  "success": true,
4  "message": "Image rotate completed successfully",
5  "data": {
6    "transformed_image_path": "/tmp/mediaprocessor_…_rotate.png",
7    "operation": "rotate",
8    "original_dimensions": [2400, 1600],
9    "new_dimensions": [1600, 2400],
10    "format": "PNG",
11    "intensity": 1.0,
12    "background_color": "transparent"
13  }
14}

Filter

One ImageMagick filter per request: blur, sharpen, edge, emboss, enhance, equalize or normalize. Radius and sigma shape the blur, sharpen and edge kernels.

Request json
1{
2  "id": "req-1",
3  "type": "image_filter",
4  "data": {
5    "image_path": "/srv/photos/street.jpg",
6    "parameters": {"filter": "edge", "radius": 1, "sigma": 0.5}
7  }
8}
Response json
1{
2  "id": "req-1",
3  "success": true,
4  "message": "Image filter completed successfully",
5  "data": {
6    "transformed_image_path": "/tmp/mediaprocessor_…_filter.png",
7    "operation": "filter",
8    "original_dimensions": [2400, 1600],
9    "new_dimensions": [2400, 1600],
10    "format": "PNG",
11    "filter_type": "edge",
12    "intensity": 1.0,
13    "background_color": "transparent"
14  }
15}

Composite

Lay one image over another: an offset for the overlay, its opacity, and a compose mode (over, multiply, screen or plus). Watermarks, badges and side-by-side comparisons.

Request json
1{
2  "id": "req-1",
3  "type": "image_composite",
4  "data": {
5    "base_path": "/srv/photos/street.jpg",
6    "overlay_path": "/srv/photos/logo.png",
7    "parameters": {"x": 40, "y": 40, "opacity": 0.8, "compose": "over"}
8  }
9}
Response json
1{
2  "id": "req-1",
3  "success": true,
4  "message": "Image composite completed successfully",
5  "data": {
6    "transformed_image_path": "/tmp/mediaprocessor_…_composite.png",
7    "operation": "composite",
8    "original_dimensions": [2400, 1600],
9    "new_dimensions": [2400, 1600],
10    "format": "PNG",
11    "intensity": 1.0,
12    "background_color": "transparent"
13  }
14}

Transform

One entry point for resize, crop, rotate and filter, picked by parameters.operation. Useful for clients that want a single request type for every geometric or filter change.

Request json
1{
2  "id": "req-1",
3  "type": "image_transform",
4  "data": {
5    "image_path": "/srv/photos/street.jpg",
6    "parameters": {"operation": "rotate", "angle": 45}
7  }
8}
Response json
1{
2  "id": "req-1",
3  "success": true,
4  "message": "Image transform completed successfully",
5  "data": {
6    "transformed_image_path": "/tmp/mediaprocessor_…_rotate.png",
7    "operation": "rotate",
8    "original_dimensions": [2400, 1600],
9    "new_dimensions": [2828, 2828],
10    "format": "PNG",
11    "intensity": 1.0,
12    "background_color": "transparent"
13  }
14}

Process Images Programmatically

No image processing library needed in your application. Send JSON, receive transformed images.

API Reference