pub fn write_with_bin_to(
        &self,
        bin: impl AsRef<Path>,
        dest: impl AsRef<Path>,
    ) -> anyhow::Result<PathBuf> {
        let cursor = Cursor::new(&self.content);
        let decoder = JpegDecoder::new(cursor)?;
        let color_type = decoder.color_type();
        let (width, height) = decoder.dimensions();
        let img = DynamicImage::from_decoder(decoder)?;

        log::debug!("Reading cargo binary from `{}`", bin.as_ref().display());
        let bin = BufReader::new(File::open(bin)?);

        let dest = dest.as_ref();
        log::debug!("Creating meme exe at `{}`", dest.display());
        let mut out = BufWriter::new(File::create(dest)?);

        let mut encoder =
            AppMarkerJpegEncoder::new_with_quality(&mut out, bin, AppMarkerConfig::default(), 100);

        encoder.encode(img.as_bytes(), width, height, color_type)?;

        Ok(dest.to_path_buf())
    }
/// Puts the bin file into the meme and write to dest
Puts the bin file into the meme and write to dest
Puts the bin file into the meme and write to dest
pub fn write_with_bin_to(
        &self,
        bin: impl AsRef<Path>,
        dest: impl AsRef<Path>,
    ) -> anyhow::Result<PathBuf> {
        let cursor = Cursor::new(&self.content);
        let decoder = JpegDecoder::new(cursor)?;
        let color_type = decoder.color_type();
        let (width, height) = decoder.dimensions();
        let img = DynamicImage::from_decoder(decoder)?;
        log::debug!("Reading cargo binary from `{}`", bin.as_ref().display());
        let bin = BufReader::new(File::open(bin)?);
        let dest = dest.as_ref();
        log::debug!("Creating meme exe at `{}`", dest.display());
        let mut out = BufWriter::new(File::create(dest)?);
        let mut encoder =
            AppMarkerJpegEncoder::new_with_quality(&mut out, bin, AppMarkerConfig::default(), 100);
        encoder.encode(img.as_bytes(), width, height, color_type)?;
        Ok(dest.to_path_buf())
    }
pub fn write_with_bin_to ( & self , bin : impl AsRef < Path > , dest : impl AsRef < Path > , ) -> anyhow :: Result < PathBuf > { let cursor = Cursor :: new ( & self . content ) ; let decoder = JpegDecoder :: new ( cursor ) ? ; let color_type = decoder . color_type ( ) ; let ( width , height ) = decoder . dimensions ( ) ; let img = DynamicImage :: from_decoder ( decoder ) ? ; log :: debug ! ( " " bin as_ref ( ) display ( ) ) ; let bin = BufReader :: new ( File :: open ( bin ) ? ) ; let dest = dest . as_ref ( ) ; log :: debug ! ( " " dest display ( ) ) ; let mut out = BufWriter :: new ( File :: create ( dest ) ? ) ; let mut encoder = AppMarkerJpegEncoder :: new_with_quality ( & mut out , bin , AppMarkerConfig :: default ( ) , 100 ) ; encoder . encode ( img . as_bytes ( ) , width , height , color_type ) ? ; Ok ( dest . to_path_buf ( ) ) }
Puts the bin file into the meme and write to dest
Puts the bin file into the meme and write to dest
&self
bin
impl AsRef<Path>
dest
impl AsRef<Path>