| Crates.io | imaginary-rs |
| lib.rs | imaginary-rs |
| version | 0.1.0 |
| created_at | 2026-01-22 16:42:25.163087+00 |
| updated_at | 2026-01-22 16:42:25.163087+00 |
| description | Fast, simple, scalable HTTP microservice for high-level image processing |
| homepage | https://github.com/ryancinsight/imaginary-rs |
| repository | https://github.com/ryancinsight/imaginary-rs |
| max_upload_size | |
| id | 2062106 |
| size | 1,128,563 |
A Rust implementation of the h2non/imaginary image processing service.
/pipeline endpoint/pipeline endpoint with URL-based image fetchingresize: Resize an image (params: width, height)crop: Crop an image (params: x, y, width, height)rotate: Rotate image (params: degrees)grayscale: Convert to grayscale (no params)blur: Blur image (params: sigma)flip: Flip vertically (no params)flop: Flip horizontally (no params)adjustBrightness: Adjust brightness (params: value)adjustContrast: Adjust contrast (params: value)sharpen: Sharpen image (no params)convert: Change format (params: format, quality)Process an image with a sequence of operations.
Request: multipart/form-data
image: The image fileoperations: JSON array of operation specs, e.g.[
{"operation": "resize", "params": {"width": 200, "height": 200}},
{"operation": "grayscale", "params": {}}
]
Response: Processed image (binary)
Process an image from a URL with a sequence of operations.
Request Parameters:
url: URL of the image to process (HTTP/HTTPS only)operations: JSON-encoded array of operation specsExample:
GET /pipeline?url=https://example.com/image.jpg&operations=[{"operation":"resize","params":{"width":200,"height":200}}]
Response: Processed image (binary)
Health check.
See test.html for a browser-based demo.
cargo build --release
cargo run
src/image/operations/.src/image/params.rs.SupportedOperation in src/image/pipeline_types.rs.execute_single_operation in src/image/pipeline_executor.rs.Imaginary-rs organizes all image processing operations into a deep, maintainable vertical module structure:
| Module | Public Operations (re-exported at top level) |
|---|---|
transform |
resize, rotate, crop, flip_horizontal, flip_vertical, enlarge, extract, zoom, smart_crop, thumbnail |
color |
grayscale, blur, adjust_brightness, adjust_contrast, sharpen |
format |
convert_format, autorotate |
watermark |
watermark |
All common operations are re-exported at the top level of the operations module for ergonomic use. Internal helpers (e.g., overlay, draw_text, watermark_image) are not part of the public API.
use imaginary::image::operations::{resize, grayscale, watermark, convert_format};
use imaginary::image::params::{ResizeParams, WatermarkParams, FormatConversionParams};
let img = /* Load a DynamicImage */;
let img = resize(img, &ResizeParams { width: 300, height: 300 });
let img = grayscale(img);
let img = watermark(img, &WatermarkParams {
text: "Imaginary-rs".to_string(),
opacity: 0.7,
position: WatermarkPosition::BottomRight,
font_size: 24,
color: [0, 128, 255],
x: None,
y: None,
})?;
let img = convert_format(img, &FormatConversionParams {
format: "jpeg".to_string(),
quality: Some(85),
})?;
Send a POST request to /pipeline with a multipart form containing:
image: the image fileoperations: a JSON array of operations (see test.html for an example)src/image/operations/.operations module.--concurrency <N>: Maximum number of concurrent HTTP requests to process (0 = unlimited, default: 0). Matches the original imaginary's concurrency option.--http-version <http1|http2>: Select HTTP version (default: http1)--tls-mode <self-signed|signed>: TLS mode (default: self-signed)--cert-path <PATH>: Path to TLS certificate (default: cert.pem)--key-path <PATH>: Path to TLS private key (default: key.pem)# Build and run with Docker
docker build -t imaginary-rs .
docker run -p 8080:8080 imaginary-rs
# Or use Docker Compose
docker-compose up
# Deploy to Kubernetes
kubectl apply -f k8s/
# Check deployment status
kubectl get pods -n imaginary-rs
/health - Basic health check/ready - Readiness check with system validation/metrics - Prometheus-compatible metricsFor complete deployment instructions, see DEPLOYMENT.md.
This project is stable and ready for production use (v0.1.0).
MIT License.