-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use open_image_from_bytes
?
#146
Comments
getting the same error when dealing with let mut png_buffer = Vec::new();
image.write_to(&mut Cursor::new(&mut png_buffer), image::ImageOutputFormat::Png,).unwrap(); however it does not seem to work with photon |
@xanderjakeq @yosefahab I wrote this function to do something very similar. Maybe it will help you. The trick is to use the /// Convert an `RgbImage` (`image` crate) to a `PhotonImage` (`photon-rs` crate)
pub fn rgb_to_photon(rgb: &RgbImage) -> PhotonImage {
let rgb24 = rgb.to_vec();
let rgb32 = rgb24_to_rgba32(rgb24);
PhotonImage::new(rgb32, rgb.width(), rgb.height())
} |
I'm not sure where you got |
I have ImageData from the
arboard
crate to get an image from the clipboard. I want to do something with that image withphoton
and save it.I'm trying to use it like this:
But I get this error:
Not sure what I'm doing wrong..
The text was updated successfully, but these errors were encountered: