image-rs / imageproc

Image processing operations
MIT License
723 stars 144 forks source link

Remove noisy `ImageBuffer` type #636

Closed ripytide closed 1 month ago

ripytide commented 1 month ago

This PR replaces the ImageBuffer type with more relevant Image and GrayImage types as appropriate.

A lot of the time functions return Image<P> anyway so using Image inside the function makes more sense to me. Also a lot of the time ImageBuffer<P, Vec<P>> is used explicitly which is repetitive and noisy compared to simply Image<P>.

The only exception to this is doc-examples which I avoided since it may teach users to rely on the imageproc::definitions::Image type synonym which I wasn't sure about. However, I'd be happy to also switch these to use Image as well if you think that'd be ok.

theotherphil commented 1 month ago

I’m a bit ambivalent about this one - it’s nice to save the typing and having to constantly specify the Container type parameter everywhere, but it’s a shame to hide the true type name and require developers to go and learn that this is actually ImageBuffer after all.

Given that we already have the type alias I guess it’s better to use it consistently than inconsistently. (Although I’m tempted to just delete the alias entirely at some point.)