Created
May 10, 2019 06:24
-
-
Save insipx/68297087222ef977733bfa3a2efe0863 to your computer and use it in GitHub Desktop.
Image Reading/Writing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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