image-rs / imageproc

Image processing operations
MIT License
744 stars 146 forks source link

Add compose module and functions #662

Closed ripytide closed 3 months ago

ripytide commented 4 months ago

This PR relies on #647 for the Rect type.

I have more functions that fit in this category I'd like to add in the future but I thought I'd start with some basic ones.

I've added three main functions crop(), flip_horizontal() and flip_vertical().

This is part of the wider effort of migrating function from image::imageops https://github.com/image-rs/image/issues/2238

theotherphil commented 4 months ago

This looks good except for the Rect changes, thanks.

None of these functions are “composing” images in any sense I can think of, but I can’t think of a good name off the top of my head. I’m happy to merge this without the Rect change and worry about module names before the next version is released

ripytide commented 3 months ago

I think I chose the name "compose" from some functions from imageops, mainly replace() and overlay() which combine multiple images hence the name compose. Though you're right the mirror and rotate functions don't really fit but I couldn't think of any other names at the time so I though I'd just put them all in the compose module. Feel free to change the module naming at any point.

ripytide commented 3 months ago

Okay I've removed the Rect changes :+1:

theotherphil commented 3 months ago

Thanks! It would be nice to have a benchmark for the cropping function to see if the parallelization actually helps, but that isn't a blocker to merging.