Skip to content

How to convert in memory image to another type? #2125

Answered by fintelia
sekoyo asked this question in Q&A
Discussion options

You must be logged in to vote

You want to use the write_to method:

let mut bytes: Vec<u8> = Vec::new();
img.write_to(&mut Cursor::new(&mut bytes), image::ImageOutputFormat::WebP)?;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sekoyo
Comment options

Answer selected by sekoyo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants