image-rs / image

Encoding and decoding images in Rust
Apache License 2.0
4.86k stars 597 forks source link

The documentation on `crop()` is confusing #2293

Open Shnatsel opened 1 month ago

Shnatsel commented 1 month ago

See https://docs.rs/image/0.25.2/image/enum.DynamicImage.html#method.crop

In image v0.25.2 the documentation for crop() states:

Note: this method does not modify the object, and its signature will be replaced with crop_imm()’s in the 0.24 release

It also took me a while to get what "does not modify the object" actually refers to. At first I thought that maybe it returns a view into the image or something. But no, it actually returns a different buffer altogether.

It's weird that it talks about 0.24 as if it's in the future in docs for v0.25. And the signatures are still different. I guess that's a work item for 0.26 now.

Shnatsel commented 1 month ago

Adding to the confusion, imageops::crop_imm() returns a view into an existing image, while DynamicImage::crop() returns a new image buffer.