Skip to content

Safe resize / and crop with aspect ratio keeping. #2790

Closed Answered by JimBobSquarePants
codec-abc asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @codec-abc

Yes you should be able to do this with the Resize Options. https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Processing.ResizeOptions.html?q=ResizeOptions

I would first crop using an intersection of the image bounds and the crop rectangle, you can then do a resize using the pad mode and set a pad color.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by codec-abc
Comment options

You must be logged in to vote
1 reply
@JimBobSquarePants
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants