image-rs / image

Encoding and decoding images in Rust
Apache License 2.0
4.87k stars 602 forks source link

Convenience function for encoding a `DynamicImage` #2225

Closed Shnatsel closed 4 months ago

Shnatsel commented 4 months ago

I am looking at the ImageEncoder documentation and the API for writing an image is fairly low-level. If I have a DynamicImage, there doesn't seem to be a function to just write to to the specified format.

Am I just looking into the wrong place in the docs? And if not, is there a reason ImageEncoder doesn't just provide a wrapper around the low-level API that accepts a DynamicImage and writes it?

fintelia commented 4 months ago

The function you are looking for is probably write_to or write_with_encoder

Shnatsel commented 4 months ago

Ah, write_with_encoder is the one. Thanks!