Implemented extra functionality for specifying fit direction #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likeImageOpsFitTopMiddle
is because the cropping only happens in one direction, never in both the X and y axis. So,ImageOpsFitTopLeft
andImageOpsFitTopRight
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.