Closed KonradLinkowski closed 3 years ago
Hi,
It seems that you are not using the print_from_file
function, although it is imported. It will help you with printing, all it needs is a path, see its signature here. You don't need to use include_bytes!
in that case.
If you really want to load the image, you can have a look at the image library. It lets you do all kinds of manipulations to an image, including access to the raw data behind it. viuer
uses it, and that's why the viuer::print
method takes as an argument a DynamicImage
.
@atanunq thanks for the respons. print_from_file
works fine, but I'm looking for the way to bundle the image with my executable.
Oh, I see.
I am afraid viuer
cannot help you with that. You should have a look at image
functionality to load the image as a usable representation. If this should happen at compile time, I guess you could do this in a macro expansion of some sorts.
Also, I noticed there is a crate that does the magic for you - rust-embed
.
Closing, as this project does not aim to achieve this functionality.
I want to bundle my images with executable. This is the code I used and it fails compilation with error
How could I convert bytes to
DynamicImage
?