Single API image transformation service written in Rust.
Simply clone the repo and run inside the root directory:
cargo run
or run with Docker
docker run -it -p 8080:8080 penumbra23/rusty-images
Run cargo run -- --help
to inspect the arguments that can be supplied via CLI.
All endpoints receive the image in a multipart/form-data
body with the entry name file
.
Returns image information like size (in bytes), width, height and format:
{
"size": 161985,
"width": 985,
"height": 2048,
"format": "image/jpeg"
}
Resizes the image. Possible query params:
keep_aspect=true
- if the image aspect ratio should be retained; in that case the highest dimension is pickedoutput_format
- convert to another format (possible values:png
,jpeg
andgif
)filter_type
- filter type to be used while rescaling (possible values:nearest
andgaussian
)
Blurs the image using the Gaussian filter with the given strength factor. Possible query params:
output_format
- convert to another format (possible values:png
,jpeg
andgif
)
Rotates the image using one of the possible values for the angle = [90, 180, 270]. Possible query params:
output_format
- convert to another format (possible values:png
,jpeg
andgif
)
For any bugs, feature requests or improvements, open up an issue and/or submit a PR. More than happy to see contributors. One of the major things this service could use is an async API, where the operations are queued and executed in an async fashion.
MIT