Jump to content

Color to Alpha


W@@dy

Recommended Posts

I made my first plugin, and it seems to have potential, something I wasn't expecting O_o

It takes colors, and changes them to a different alpha level of your choice. It was inspired by "Grim Color Reaper", one of (what I think) the most useful plugins out there. However it was always lacking in some regards, and I think this covers them. Or rather, this is a start in that direction.

It can remove any color you want (Color wheel for UI), with a tolerance level as well to provide some flexibility.

Additionally, you can make the tolerance slider make the entire image 0 alpha (not terribly useful, I agree, but available).

The tolerance level also gives the plugin a third, unintentional, feature; allowing you to remove any color except the one you have selected.

This is done by setting the tolerance level to 254 (each number represents 1 rbg value), then changing the RBG values in the color wheel to what you desire, and repeat up to twice to remove all colors you don't want.

This is best explained with pictures.

I don't mean for this to be a guide, or tutorial. Just a means to explicitly explain what this plugin can do so I can receive feedback.

Original.png

This is our starting image. The colors are, from left to right,

Black, White, Pure Red, Pure Green, Pure Blue, random assortment of RBG values.

Step1.png

We start by opening the plugin, then setting the Tolerance Level to 254, then dropping our RBG value to 0,0,0

Our goal is to get Red all by itself.

Step2.png

Now we set the Blue and Green value of the RGB in the color wheel to 1, and 1.

This immediately removes everything except white and pure red.

Now click 'Okay'

The final step, is to remove white.

Step3.png

Do this by opening up the plugin again, and this time set the RGB values to 255,255,255.

This will remove white.

Additionally, we could change this process to remove green, or blue as well, simply by changing which rbg values we set to 1 in step 3.

The last two options I haven't mentioned are the "Finalized Alpha" slider and that checkbox.

"Finalized Alpha" simply controls what alpha level you convert your colors to.

The checkbox was a last minute "Hey that sounds neat" idea.

Checking it disables the plugin, reverting your canvass back to it's original form, before the plugin affected it.

This is so you can get a good look at how you're affecting your image, before clicking "Okay"

I thought it was a nice touch, instead of having to alternate between Ctrl+Z and Ctrl+Y after applying the plugin.

As it stands...it's more or less an over elaborate magic wand tool, except it doesn't make selections and applies globally.

I'd like to make it start antialiasing things after it changes to alpha and maybe affect semi-transparent pixels, but I haven't even looked into that yet. Any tips as to where to start? As in, should I just make it depend on another plugin, or code the antialiasing myself (I have no idea how to do that lol)

And thoughts on this? Is it worth continuing?

Oh, also, I set this to Effects>Color. I read the rules for plugin placement...but it all went over my head >_> so if I did a no-no, could you point it out? I don't really know what "Effect's Render/OnRender" are, so I'm hoping I don't have to worry about messing it, but what do I know.

http://www.mediafire.com/file/d6yuyl022o2rr5t/ColortoAlpha.dll

(first time sharing with mediafire, I hope this works)

SamusSig-1.png
Link to comment
Share on other sites

>_> I searched for that name and came up with nothing. No biggy, names are simple to change.

It is pretty similar, except that it uses a range. No problem, this is just the beginning and exactly why I put this here.

Next two things I'll shoot for then is to make it skip around an object it doesn't match with, and then antialias that object.

Edit: I've been thinking about it for a long while, and I can't figure out the best method to work around an object.

For example I want to remove black, but there's a circle in the image filled with black, outlined with white.

How would I go about removing all the black on the outside of the circle?

The only way I can imagine doing it is to make two loops, one that travels left to right, thens stops when it hits a color it doesn't want.

Then repeat going right to left, and stopping on a color it doesn't want.

That seems unnecessary, lengthy, and buggy though. It would cause issues in objects that aren't closed shapes as well...

Hmm...any tips on how to approach this? I don't exactly need code, but just a method to solve the problem.

Or name a plugin that does something similar that I can look into

Edited by W@@dy
SamusSig-1.png
Link to comment
Share on other sites

  • 3 months later...

Hey this is really cool :) Was the Grim Color Reaper code useful to you? Any ideas about where to take this next?

About ignoring some regions when removing colors, it's really easy if your plugin only operates inside the selection (like the Reaper does). Just select the areas you want, invert selection, then run it. So for example, you can remove black outside an object but not inside.

Cheers!

Jotaf

Link to comment
Share on other sites

  • 1 year later...

Look for this plugin under Effects > Color.  Tanel's Color to Alpha can be found in the same location.

Link to comment
Share on other sites

Excellent!  Welcome to the forum.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...