image icon indicating copy to clipboard operation
image copied to clipboard

Consider removing the `ImageDecoderRect` trait

Open Shnatsel opened this issue 1 year ago • 2 comments

The ImageDecoderRect trait is supposed to help decode only the specified part of the image, as opposed to the entire thing.

As of v0.25, only BMP and Farbfeld decoders implement it: https://docs.rs/image/0.25.4/image/trait.ImageDecoderRect.html

Given the lack of format support, it's probably best to remove it for now, to reduce the API surface and maintenance burden. We could possibly re-introduce it later if there is enough demand.

Shnatsel avatar Oct 17 '24 22:10 Shnatsel

FWIW imagemagick does provide this functionality, so a proper implementation of this could potentially be of use to wondermagick. But it is only an optimization, ideally and we'd have to generalize it to animations as well, so I don't think it's worth the trouble at this stage.

Shnatsel avatar Oct 17 '24 22:10 Shnatsel

I think this is worth considering. Part of the problem with ImageDecoderRect is there's formats were it is sometimes possible to extract portions of the image, but it depends on the choices made by the encoder.

If we do decide to remove, thing thing to do would be marking the trait as deprecated for a few releases and see if any concerns are raised.

fintelia avatar Oct 18 '24 02:10 fintelia