I'm wondering if it makes sense to have separate functions for cropping, resizing, and rotating. Perhaps that doesn't make sense in terms of what the apps need to do but this is a large, complex function that in terms of maintainability and readability may benefit from being different, smaller functions.