Hellfire010 Posted November 18, 2006 Share Posted November 18, 2006 I was wondering if it were possible to make a plugin for the following effect: Getting from this: To this: By using a magicwand to select all of the blue (including that "under" the red) and deleting. All on the same layer. Better example would be: You're cropping a picture, the outline of the picture (black) has several semi grayish pixels, semi blue (same blue as background). Using the magic wand with this effect^ would select the blue in the background, including that overlapping the gray, and remove it when you press delete. Alternatively, perhaps an effect that removes all hues in a certain range (similar to the already made plugin to change colors). -Used for cropping n stuff Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 18, 2006 Share Posted November 18, 2006 Sure, easy. Here's a Codelab script to basically do what you want: void Render(Surface dst, Surface src, Rectangle rect) { PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; for(int y = rect.Top; y { for (int x = rect.Left; x { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x,y]; if (CurrentPixel.R >= PrimaryColor.R) { CurrentPixel.R -= PrimaryColor.R; CurrentPixel.A=(byte)((CurrentPixel.A - PrimaryColor.R } else { CurrentPixel.A=(byte)((CurrentPixel.A - CurrentPixel.R CurrentPixel.R = 0; } if (CurrentPixel.G >= PrimaryColor.G) { CurrentPixel.G -= PrimaryColor.G; CurrentPixel.A = (byte)((CurrentPixel.A - PrimaryColor.G } else { CurrentPixel.A=(byte)((CurrentPixel.A - CurrentPixel.G CurrentPixel.G = 0; } if (CurrentPixel.B >= PrimaryColor. { CurrentPixel.B -= PrimaryColor.B; CurrentPixel.A=(byte)((CurrentPixel.A - PrimaryColor.B ; } else { CurrentPixel.A=(byte)((CurrentPixel.A - CurrentPixel.B ; CurrentPixel.B = 0; } dst[x,y] = CurrentPixel; } } } } All you need to do is use the color picker to set your primary color to the color you want to eliminate (i.e. blue, in your example). Then, run the effect in Codelab. Enjoy. 8) P.S. I'm sure there's a more efficient way to do this, but what do you want for 10 minutes of work? Oh, and here's your precompiled DLL: StripPrimaryColor.dll. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
mastodonant Posted November 18, 2006 Share Posted November 18, 2006 IM NOT SURE IF THIS IS WHAT YOU WANTED... but you could just cut out the purple and the blue, then add a new layer of red next to the solid red then set the layer properties opacity to the visibility you like it Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 18, 2006 Share Posted November 18, 2006 mastodonant, that's correct. And, fairly easy for a simple example that he provided. I think he wants something that can be used for very complicated pictures. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
RaveN Posted November 18, 2006 Share Posted November 18, 2006 If your trying to crop out a border from an image, in your other example, use the rectangular marquee tool and select the picture. Then inverse your selection by going to Edit- Invert selection. Or hit Ctrl+I, delete it. If you want to use a different color, then make a new layer, select the transparent part on the other layer, then fill it on the new layer, and adjust opacity. Quote Link to comment Share on other sites More sharing options...
Hellfire010 Posted November 19, 2006 Author Share Posted November 19, 2006 Boltbait is correct, masto. And Raven, I don't think that's what I was asking for... I don't think... Thanks for the code. I'm gonna try it out now. Thanks a whole bunch for that, it's great for a few things. Yet, it isn't precise enough for what i had in mind. I was wondering if it were possible to add the same color selection method as the one used in the "Conditional Hue/Saturation" plugin. Because the plugin you posts selects white, so the color selector from that other plugin ^ has an ability to not select white within it's selection thing... and stuff xD 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.