Skip to content

Instantly share code, notes, and snippets.

@insipx
Created May 10, 2019 06:24
Show Gist options
  • Save insipx/68297087222ef977733bfa3a2efe0863 to your computer and use it in GitHub Desktop.
Save insipx/68297087222ef977733bfa3a2efe0863 to your computer and use it in GitHub Desktop.
Image Reading/Writing
use std::io::{Read, Write};
use std::fs::File;
fn main() {
let mut image = File::open("./image.jpg").unwrap();
let mut buffer = Vec::new();
let bytes = image.read_to_end(&mut buffer);
let mut out = File::open("./output.jpg").unwrap();
out.write(buffer.as_slice()).unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment