Image Processing

Transform images with precise control. From basic resize operations to advanced ImageMagick effects, all accessible through the JSON protocol.

Resize & Scale

High-quality image resizing supporting multiple interpolation methods. Resize by exact dimensions, percentage, or fit within a bounding box while maintaining aspect ratio. Supports Lanczos, bicubic, bilinear, and nearest-neighbor interpolation.

Request json
1{
2  "request_id": "resize-001",
3  "type": "resize_image",
4  "image_path": "/data/photo.jpg",
5  "width": 800,
6  "height": 600,
7  "method": "lanczos"
8}
Response json
1{
2  "request_id": "resize-001",
3  "result": {
4    "output_path": "/tmp/resized_photo.jpg",
5    "original_size": { "width": 4032, "height": 3024 },
6    "new_size": { "width": 800, "height": 600 }
7  }
8}

Crop & Trim

Extract precise regions from images with pixel-accurate cropping. Support for automatic trim detection that removes uniform borders, and aspect-ratio-constrained cropping for consistent output dimensions.

Request json
1{
2  "request_id": "crop-001",
3  "type": "crop_image",
4  "image_path": "/data/photo.jpg",
5  "x": 100,
6  "y": 50,
7  "width": 500,
8  "height": 400
9}
Response json
1{
2  "request_id": "crop-001",
3  "result": {
4    "output_path": "/tmp/cropped_photo.jpg",
5    "crop_region": { "x": 100, "y": 50, "w": 500, "h": 400 }
6  }
7}

Rotate & Flip

Rotate images by arbitrary angles with configurable background fill color. Flip horizontally or vertically. Rotation preserves the full image content by expanding the canvas as needed.

Request json
1{
2  "request_id": "rotate-001",
3  "type": "rotate_image",
4  "image_path": "/data/photo.jpg",
5  "angle": 45,
6  "background": "#FFFFFF"
7}
Response json
1{
2  "request_id": "rotate-001",
3  "result": {
4    "output_path": "/tmp/rotated_photo.jpg",
5    "angle": 45,
6    "new_size": { "width": 4800, "height": 4800 }
7  }
8}

Color Filters

Apply a wide range of color transformations: grayscale conversion, sepia tone, color inversion, brightness and contrast adjustment, saturation control, and custom color matrix transforms. Chain multiple adjustments in a single request.

Request json
1{
2  "request_id": "filter-001",
3  "type": "apply_filter",
4  "image_path": "/data/photo.jpg",
5  "filters": [
6    { "type": "brightness", "value": 1.2 },
7    { "type": "contrast", "value": 1.1 },
8    { "type": "saturation", "value": 0.8 }
9  ]
10}
Response json
1{
2  "request_id": "filter-001",
3  "result": {
4    "output_path": "/tmp/filtered_photo.jpg",
5    "filters_applied": ["brightness", "contrast", "saturation"]
6  }
7}

Blur & Sharpen

Gaussian blur for noise reduction and depth-of-field effects, box blur for fast averaging, and unsharp mask for intelligent sharpening. Kernel size and sigma are configurable per request.

Request json
1{
2  "request_id": "blur-001",
3  "type": "blur_image",
4  "image_path": "/data/photo.jpg",
5  "method": "gaussian",
6  "radius": 5,
7  "sigma": 2.0
8}
Response json
1{
2  "request_id": "blur-001",
3  "result": {
4    "output_path": "/tmp/blurred_photo.jpg",
5    "method": "gaussian",
6    "radius": 5,
7    "sigma": 2.0
8  }
9}

ImageMagick Transforms

Full ImageMagick integration enables advanced operations: format conversion between 200+ image formats, compositing and layering, artistic effects (oil paint, charcoal, sketch), annotation and text overlay, and batch processing with complex transform chains.

Request json
1{
2  "request_id": "magick-001",
3  "type": "imagemagick_transform",
4  "image_path": "/data/photo.jpg",
5  "operations": [
6    { "op": "convert", "format": "png" },
7    { "op": "effect", "name": "oil_paint", "radius": 4 },
8    { "op": "annotate", "text": "Sample", "position": "south" }
9  ]
10}
Response json
1{
2  "request_id": "magick-001",
3  "result": {
4    "output_path": "/tmp/transformed_photo.png",
5    "operations_applied": 3,
6    "output_format": "png"
7  }
8}

Process Images Programmatically

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

API Reference