C
C#7mo ago
Arsenic

ImageSharp

How can I crop a circle from a photo in ImageSharp and draw a blue line around it?
4 Replies
Keswiik
Keswiik7mo ago
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)
Arsenic
ArsenicOP7mo ago
How can I crop a circular shape because the Crop method only receives the height and width or rectangle
image.Mutate(iImageProcessingContext => iImageProcessingContext.Crop());
image.Mutate(iImageProcessingContext => iImageProcessingContext.Crop());
Keswiik
Keswiik7mo ago
likely need to crop using a rectangle, then fill the edges with transparency using paths
Want results from more Discord servers?
Add your server