Hitlinemoss Posted May 20 Share Posted May 20 To clarify what I mean: let's say I have an image like this, with a gray background: I want to replace the gray background with a transparent one. However, because the original image was drawn with an antialiased brush, the edge of the image and the background blend together, so the magic wand tool isn't quite up to the task: Now, with enough manual effort it's possible to hide these kinds of artifacts. (My current process is to create a silhouette of the image in the same color as the original edge, then use a plugin to antialias that silhouette, delete the areas overlapping with the original image, antialias it again, and delete the areas overlapping with the background.) But this is slow, and it tends to look ugly and blocky on close inspection. Ideally, I'd like some kind of plugin that I can run to easily replace the background color with transparency; I figure that, if the background is a single static color, there's some kind of algorithm you could run to just convert pixels of that color to transparency (and pixels somewhat-that-color to somewhat-transparent), right? Does a plugin along these lines exist? Quote Link to comment Share on other sites More sharing options...
BoltBait Posted May 20 Share Posted May 20 Step 1: Install my plugin pack at https://forums.getpaint.net/BoltBaitPluginPack Step 2: Magic wand the background (gray in your case) and delete it. Step 3: Use my Effects > Object > Feather Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Hitlinemoss Posted May 20 Author Share Posted May 20 1 hour ago, BoltBait said: Step 1: Install my plugin pack at https://forums.getpaint.net/BoltBaitPluginPack Step 2: Magic wand the background (gray in your case) and delete it. Step 3: Use my Effects > Object > Feather I actually did install this plugin pack earlier today (good work on it, by the way, I appreciate the sheer diversity of tools here) but this specific tool isn't quite what I'm looking for. It directly erases pixels from the outside of the image, which is good for quick-fixes but runs into the problem of erasing thinner lines entirely or missing some sharp concave corners. The Switch Grey to Alpha tool from the same plugin pack is *almost* what I'm after here, but the two problems there are that it it only fully works on pure white/black backgrounds (rather than other colors like blue or whatever) and that it affects the entire selected area indiscriminately (so, if it's a blue outline on a white background, the blue becomes partially transparent even at its bluest). I guess the best way to phrase what I'm looking for is, like, a plugin that lets me designate one color as the "background" and a second color as "not the background", and then have the background color erased, the non-background color untouched, and colors between the two colors gradually get more or less transparent depending on which of the two they're closer to. Quote Link to comment Share on other sites More sharing options...
Pixey Posted May 20 Share Posted May 20 Welcome onboard @Hitlinemoss You try this too: Go to this site to remove the background. Load up the image and use AA's Assistant. On your bottom layer add a color. Quote How I made Jennifer & Halle in Paint.net My Gallery | My Deviant Art "Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon. Link to comment Share on other sites More sharing options...
Hitlinemoss Posted May 20 Author Share Posted May 20 32 minutes ago, Pixey said: Welcome onboard @Hitlinemoss You try this too: Go to this site to remove the background. Load up the image and use AA's Assistant. On your bottom layer add a color. This site seems to be doing roughly the same thing as the aforementioned Feather plugin (i.e, just erasing the pixels at the edge of the image). Which is still good for a quick fix, but with this thread I'm mostly just wondering if there's a more specialized plugin for this kind of thing that preserves the non-background pixels as accurately as possible. Quote Link to comment Share on other sites More sharing options...
_koh_ Posted May 20 Share Posted May 20 Not sure you are happy with this result, but this CodeLab script makes the pixel more transparent when pixel color is more closer to the primary color. #region UICode DoubleSliderControl threshold = 0.32; // [0,1] Threshold #endregion protected override void OnInitializeRenderInfo(IGpuImageEffectRenderInfo renderInfo) { renderInfo.ColorContext = GpuEffectColorContext.WorkingSpace; base.OnInitializeRenderInfo(renderInfo); } protected override IDeviceImage OnCreateOutput(IDeviceContext DC) { using var source = Environment.SourceImage.CreateRef(); using var color = new FloodEffect2(DC, (ColorRgba128Float)Environment.PrimaryColor); using var vector = new HlslBinaryOperatorEffect(DC, source, HlslBinaryOperator.Subtract, color); using var length = new HlslUnaryFunctionEffect(DC, HlslUnaryFunction.Length, vector); using var alpha = new HlslBinaryOperatorEffect(DC, length, HlslBinaryOperator.Multiply, new Vector4Float((float)(1 / threshold))); using var clamp = new HlslUnaryFunctionEffect(DC, HlslUnaryFunction.Saturate, alpha); using var output = new HlslBinaryOperatorEffect(DC, source, HlslBinaryOperator.Multiply, clamp); return output.CreateRef(); } 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.