desteg/src/main.rs

50 lines
925 B
Rust

#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
//extern crate rand;
extern crate image;
//extern crate tempfile;
//use std::io;
use rocket::Data;
use rocket::response::content;
#[cfg(test)] mod tests;
#[get("/")]
fn index() -> &'static str {
"
Usage
POST /
accepts image data in the body of the requests, returns the
image with more entropy added to the least significant bits of each
colour channel.
EXMAPLE: curl --data-binary @file.jpg http://localhost:8000
"
}
#[post("/", data = "<incoming_image>")]
fn desteg(incoming_image: Data) -> image::DynamicImage {
let image_buffer = image::load_from_memory(incoming_image.peek()).unwrap();
image_buffer
}
fn rocket() -> rocket::Rocket {
let my_rocket = rocket::ignite().mount("/", routes![index]);
my_rocket
}
fn main() {
rocket().launch();
}