let data = req.uri().path().split("/").skip(3).next().unwrap();
let mut cursor = Cursor::new(Vec::new());
let scale = 16;
- let tdim_x = 32 * scale;
- let tdim_y = 32 * scale;
let img: RgbImage = {
let canvas_option = &mut *canvas0.lock().unwrap();
let canvas = canvas_option.take().ok_or(CanvasError::NotExists)?;
let canvas = rgb_encode_to_canvas(canvas, percent_decode_str(&data).into_iter().borrow_mut())?;
canvas_option.insert(canvas).img.clone()
};
+ let (tdim_x, tdim_y) = img.dimensions();
+ let (tdim_x, tdim_y) = (tdim_x * scale, tdim_y * scale);
let img = resize(&img, tdim_x, tdim_y, FilterType::Nearest);
to_imageresult(write_buffer_with_format(&mut cursor, &img, tdim_x, tdim_y, ColorType::Rgb8, Png))?;
Ok(HttpResponse::build(StatusCode::OK)