An Rust library for creating HTTP image servers that can:
- accept image uploads via multi-part forms at
POST /upload
- serve existing uploads at
GET /uploads/{filename}.{extension}
.- substitute
{extension}
withpng
,jpeg
, orwebp
for dynamic encoding. - use query string parameter
w={width}
andh={height}
for dynamic resizing - use query string parameter
w={width}
andh={height}
for dynamic resizing - use query string parameter
stretch={boolean}
to determine whether resizing should affect aspect ratio. Defaults tofalse
, which preserves aspect ratio. - use query string parameter
sampling={method}
to specify which algorithm to use for resizing. Options aretriangle
,catmullrom
,gaussian
,lanczos3
, andnearest
. Defaults tonearest
.
- substitute
# Cargo.toml
[dependencies]
imogen = { git = "https://github.com/craigfay/imogen.git", ref = "1.0.0" }
// main.rs
use imogen::ImageServer;
fn main() {
ImageServer::listen(8080);
}