lilliput icon indicating copy to clipboard operation
lilliput copied to clipboard

Implemented extra functionality for specifying fit direction

Open theRoughCode opened this issue 6 years ago • 5 comments

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 ImageOpsSizeMethods: 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.

theRoughCode avatar May 29 '18 17:05 theRoughCode

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 avatar Nov 26 '18 14:11 majuansari

@majuansari I would ask @brian-armstrong-discord as he's the code owner of this repository! :)

theRoughCode avatar Nov 28 '18 20:11 theRoughCode

I also have a use case for this. Would be nice to have this merged in.

rroller avatar Dec 18 '18 03:12 rroller

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!

brian-armstrong-discord avatar Feb 05 '19 20:02 brian-armstrong-discord

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.

brian-armstrong-discord avatar Feb 05 '19 21:02 brian-armstrong-discord