lilliput
lilliput copied to clipboard
Implemented extra functionality for specifying fit direction
Currently, there is no flexibility in the way Image fit is done. The decoded image is centred around the middle of the original image by default. This PR implements 4 additional ImageOpsSizeMethod
s: ImageOpsFitTopLeft
, ImageOpsFitTopRight
, ImageOpsFitBottomLeft
, ImageOpsFitBottomRight
. These gives the user more flexibility on how they want to align their image respective to the original image. The reason why there aren't more options like ImageOpsFitTopMiddle
is because the cropping only happens in one direction, never in both the X and y axis. So, ImageOpsFitTopLeft
and ImageOpsFitTopRight
will accomplish the same thing if done in a scenario where the height is cropped (i.e. aligned to top half).
I've also updated the README to reflect these changes and give readers a better idea of how to resize their images.
This looks like a very good option . Can we merge this ?
@theRoughCode Is there anyway i can use this feature by extending the package ?
@majuansari I would ask @brian-armstrong-discord as he's the code owner of this repository! :)
I also have a use case for this. Would be nice to have this merged in.
Hey @theRoughCode Sorry for the radio silence on my end. This does actually look interesting, would you mind cleaning up the recent conflicts with master? Thank you!
As far as how the options should work, I tried to mirror PIL since that's what inspired this project, so I would say let's do what PIL does for these sorts of ops.