ImageSharp
How can I crop a circle from a photo in ImageSharp and draw a blue line around it?
4 Replies
When cloning or mutating an image, you should get an instance of
IImageProcessingContext
which has extension methods to modify the image
https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Processing.html
In your case, you may want to:
- create a new, empty image with your desired size (border thickness + crop dimensions)
- mutate empty image with background color of your choice
- clone the original image, apply crop to it (to crop dimensions specified above)
- mutate the new image and draw your cropped image on it
(note that all of this can be very easily found by googling, which I just did)How can I crop a circular shape because the Crop method only receives the height and width or rectangle
likely need to crop using a rectangle, then fill the edges with transparency using paths
https://github.com/SixLabors/Samples/blob/main/ImageSharp/AvatarWithRoundedCorner/Program.cs this should help
GitHub
Samples/ImageSharp/AvatarWithRoundedCorner/Program.cs at main · Six...
:card_index: General samples for various Six Labors projects - SixLabors/Samples