image-rs / imageproc

Image processing operations
MIT License
758 stars 149 forks source link

Add `resize()` methods and an `interpolate()` method. #671

Open ripytide opened 5 months ago

ripytide commented 5 months ago

For https://github.com/image-rs/image/issues/2238,

I've renamed DynamicImage::resize() to resize_exact(), resize_to_fill() to resize_crop_to_fill() and imageops::resize() to resize_max_no_crop().

I've added doc-tests, they're not amazing as they just use zeros at the moment but they're better than nothing.

As an aside: image having both DynamicImage::resize() and imageops::resize() but them having different semantics, _max_no_crop() vs _exact(), seems like such a foot-gun and all the more reason image processing operations should be standardized in the imageproc crate and removed from the image crate.

Since resize() uses interpolation I also added a pub interpolate(image, x, y, interpolation: Interpolation) method and also made the specific interpolation variant functions like interpolate_bilinear() public as well which should fix #546.