Skip to content

Commit

Permalink
Merge pull request #1816 from Flashover89/master
Browse files Browse the repository at this point in the history
Replace deprecated PngEncoder::encode with PngEncoder::write_image fo…
  • Loading branch information
HeroicKatora committed Oct 29, 2022
2 parents 14eae6d + b63463f commit c874eab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dynimage.rs
Expand Up @@ -19,7 +19,7 @@ use crate::error::{ImageError, ImageResult, ParameterError, ParameterErrorKind};
// FIXME: These imports exist because we don't support all of our own color types.
use crate::error::{ImageFormatHint, UnsupportedError, UnsupportedErrorKind};
use crate::flat::FlatSamples;
use crate::image::{GenericImage, GenericImageView, ImageDecoder, ImageFormat, ImageOutputFormat};
use crate::image::{GenericImage, GenericImageView, ImageDecoder, ImageFormat, ImageOutputFormat, ImageEncoder};
use crate::imageops;
use crate::io::free_functions;
use crate::math::resize_dimensions;
Expand Down Expand Up @@ -829,14 +829,14 @@ impl DynamicImage {
#[cfg(feature = "png")]
image::ImageOutputFormat::Png => {
let p = png::PngEncoder::new(w);
p.encode(bytes, width, height, color)?;
p.write_image(bytes, width, height, color)?;
Ok(())
}

#[cfg(feature = "pnm")]
image::ImageOutputFormat::Pnm(subtype) => {
let mut p = pnm::PnmEncoder::new(w).with_subtype(subtype);
p.encode(bytes, width, height, color)?;
let p = pnm::PnmEncoder::new(w).with_subtype(subtype);
p.write_image(bytes, width, height, color)?;
Ok(())
}

Expand Down

0 comments on commit c874eab

Please sign in to comment.