We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the following on an existing image to clear it does nothing...
imageToProcess.Mutate(i => i.Fill(SixLabors.ImageSharp.Color.Transparent));
However doing the following works...
var graphicsOptions = new GraphicsOptions { AlphaCompositionMode = PixelAlphaCompositionMode.Clear }; var rectangle = new RectangleF(0, 0, imageToProcess.Width, imageToProcess.Height); imageToProcess.Mutate(i => i.Fill(graphicsOptions, SixLabors.ImageSharp.Color.Transparent, rectangle));
I assume the defaults should of been good enough for the first to work
The text was updated successfully, but these errors were encountered:
Here is a little extension that makes life easier:
public static class ImageExtensions { public static void Clear(this IImageProcessingContext source, Color color) { var graphicsOptions = new GraphicsOptions { AlphaCompositionMode = PixelAlphaCompositionMode.Clear }; var size = source.GetCurrentSize(); source.Fill(graphicsOptions, color, new Rectangle(0, 0, size.Width, size.Height)); } }
Just call it:
imageToProcess.Mutate(i => i.Clear(Color.Transparent);
Sorry, something went wrong.
Untill we add our own set of Clear() apis the most efficient way to do this as of now is
Clear()
public static class ImageExtensions { public static void Clear(this IImageProcessingContext source, Color color) { var graphicsOptions = new GraphicsOptions { AlphaCompositionMode = PixelAlphaCompositionMode.Src, ColorBlendingMode = PixelColorBlendingMode.Normal }; source.Fill(graphicsOptions, color); } }
No branches or pull requests
Using the following on an existing image to clear it does nothing...
imageToProcess.Mutate(i => i.Fill(SixLabors.ImageSharp.Color.Transparent));
However doing the following works...
I assume the defaults should of been good enough for the first to work
The text was updated successfully, but these errors were encountered: