Skip to content

How to load a image from a path #819

Closed Answered by pragmatrix
Arthex1 asked this question in Q&A
Discussion options

You must be logged in to vote

Looks to me like this decodes the image twice, first the image library and then passes the raw bytes to skia-safe (which attempts to decode again), try to read the encoded image with Rust's fs:: functions. See here for an example that uses include_bytes:

pub fn mandrill() -> Image {
let bytes = include_bytes!("resources/mandrill_512.png");
let data = Data::new_copy(bytes);
Image::from_encoded(data).unwrap()
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Arthex1
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
Converted from issue

This discussion was converted from issue #818 on July 11, 2023 07:36.