Skip to content

Actually changing pixel transparency during Mutate #2185

Answered by JimBobSquarePants
jhwheuer asked this question in Q&A
Discussion options

You must be logged in to vote

I can't seem to replicate your issue. Here's some code demonstrating working with bitmaps of varying bit depth.

Note it would be more efficient to use Vector4 for rather than converting to/from Rgba32, in addition to the lack of converting overhead (which these methods are designed to avoid) you could then pow2 your distance threshold and used Vector4.DistanceSquared(...) to get the difference across all components faster.

using Dicussion2185;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;

Console.WriteLine("Hello, World!");

var appPath = Path.Combine(Directory.GetCurrentDirectory(), @".…

Replies: 4 comments 29 replies

Comment options

You must be logged in to vote
9 replies
@jhwheuer
Comment options

@JimBobSquarePants
Comment options

@jhwheuer
Comment options

@jhwheuer
Comment options

@jhwheuer
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
18 replies
@JimBobSquarePants
Comment options

@antonfirsov
Comment options

@jhwheuer
Comment options

@JimBobSquarePants
Comment options

@jhwheuer
Comment options

Answer selected by jhwheuer
Comment options

You must be logged in to vote
2 replies
@tocsoft
Comment options

@jhwheuer
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
4 participants