printpdf icon indicating copy to clipboard operation
printpdf copied to clipboard

Cannot convert from BmpDecoder

Open tronta opened this issue 3 years ago • 2 comments

I used to embed an image like this:

        let image_bytes = include_bytes!("../data/image.bmp");
        let mut image_file = Cursor::new(image_bytes.as_ref());
        let Bmp = image_crate::bmp::BmpDecoder::new(&mut image_file).unwrap();
        let logo = Image::try_from(Bmp).unwrap();

But with the new version I get the following error message when using the try_from:

the trait bound `printpdf::Image: std::convert::From<exporter::document::image_crate::bmp::BmpDecoder<&mut std::io::Cursor<&[u8]>>>` is not satisfied
the following implementations were found:
  <printpdf::Image as std::convert::From<printpdf::ImageXObject>>
required because of the requirements on the impl of `std::convert::Into<printpdf::Image>` for `exporter::document::image_crate::bmp::BmpDecoder<&mut std::io::Cursor<&[u8]>>`
required because of the requirements on the impl of `std::convert::TryFrom<exporter::document::image_crate::bmp::BmpDecoder<&mut std::io::Cursor<&[u8]>>>` for `printpdf::Image`rustcE0277
mod.rs(479, 5): required by `std::convert::TryFrom::try_from`

Anything special I need to do now?

tronta avatar Jan 04 '22 08:01 tronta