Jump to content
How to Install Plugins ×

Color Clearer


MJW

Recommended Posts

what is the difference between color clearer and reverse blend set to average color; i've tried and got the same things with the picture of spider.

on the other hand on the bomber i've applied manual color correction and then magic wand with first tolerance to 0 to get fine outline and 16 to achieve a good result;

better than with anything else. the two pictures got non uniform blue color backgrounds.

post-79095-0-85338600-1465289281_thumb.j

post-79095-0-03482500-1465289301_thumb.p

post-79095-0-23372000-1465289421_thumb.p

Link to comment
Share on other sites

Hi MJW!

 

I've tried your new plugin with the example pic I used on 'Make Transparent' plugin the other day.  Here are the results:

 

colorclearer_01.jpg     colorclearer_02.png   

                                               Original                                                                                                      Make Transparent

   

colorclearer_03.png

                                         Color Clearer

 

 

I notice that your plugin seems to be more precise. It left some of a really dark shade of orange (more red I believe) behind. Is this correct?   Thanks!     :)

Edited by lynxster4
re-hosted image
  • Like 1
  • Upvote 1
Link to comment
Share on other sites

homebrew: Obviously Color Clearer is much simpler than Reverse Blend. It was intended to resemble Make Transparent. Besides simplicity -- which is an advantage if that's exactly what you want to do -- the main advantage over Reverse Blend is that Color Clearer handles partial transparency correctly. Color Clearer is also slightly more accurate than Reverse Blend. I endeavored to make it exactly match the original image when blended to a background of the selected color. So far, it looks like I succeeded, but there are lots of combinations of color and transparency, and I certainly haven't tested them all.

 

I'll mention that handling partial transparency turns out to be remarkably easy. I thought it would be something like multiplying the computed alpha by the image pixel alpha. Instead, it's simply a matter of computing the new alpha and color relative to the image color alpha-blended with the selected color. That's the color that has to be matched.

 

lynxster4: I'd always assumed Make Transparent reduced the alpha and modified the color so that the image didn't change when blended to the selected color. I intended to modify it to handle transparency. I discovered, though, that when the image color is light gray, and the selected color is dark gray, blending to the dark gray does not produce the original color. (I believe Make Transparent only works the way I'd expected when all the color components are 0 or 255.) It may be a bug, or it may be that Make Transparent simply wasn't intended to do what I expected it to do. In any case, because it required a completely different algorithm and produced substantially different results, I decided to write my own plugin instead of modifying Make Transparent.

 

So in summary, if you want to remove the background color in a way that it will match the original image when blended with the background color, Make Transparent won't do it while Color Clearer will. (Reverse Blend will also work, provided the image doesn't have partially transparent pixels.)

Link to comment
Share on other sites

lynxster4:

It left some of a really dark shade of orange (more red I believe) behind. Is this correct?


Of course there's always the possibility of a bug, but I doubt that's the case here. Reverse Blend behaves the same way. The reason is probably that the orange contains a lot of green, while the red color contains very little. In order to blend to the original color, the alpha must be fairly large, since a small value results in too much green being blended in. One of the color components of the modified color is always either 0 or 255. Otherwise, alpha could be decreased. In this case green is 0, making the color redder than originally.

  • Like 1
Link to comment
Share on other sites

I just realized there's an oddity, which isn't exactly a bug, but nevertheless bugs me. When calculating the new color values, there is often a range of values for each of the RGB components that will result in the same color, especially for small alphas. Currently, I rather arbitrarily use the highest value. The result of this is that if for one of the RGB color components, the selected color value is the same as the color value being matched, the computed value might be another, different value. That doesn't seem to make much sense, so I think I'll fix it. I'm not sure of the best way, though. The easy way is to test to see if the color values match, and if so, skip the normal computation and use that value. I may, though, want to change the computation to use the middle of the range, or something like that, in a way that gives the input values when they match. I'll need to think about it.

Link to comment
Share on other sites

I've been able to modify “dull” white clouds and blue skies into something more interesting by combining Hot Metal Glow with Color Clearer —at least within the scope of what I consider an interesting sky. Here's an example in which I use Color Clearer to remove the red “bloody” areas created by Hot Metal Glow while preserving the rest intact:

 

Color_Clearer_test_collage.jpg

 

The Hot Metal Glow settings I apply to a duplicate of the sky layer are: Celsius Temperature = 0, Orange Desaturation = 1, Invert Color Range = True, and everything else at defaults.

Next, I apply Color Clearer to this hot-metal-glowed layer while keeping the original sky layer below it, in two steps, first selecting #C00000 as the color to make transparent, and subsequently choosing pure red as the color to make transparent.

Finally, I add a black and white gradient layer set to overlay above both sky layers (this is to fade some of the clouds and to add a more vivid light to the finished sky).

 

Everything was tested on a 100% PdN sky layer, but I guess it may work well on a photo of a real sky (check pending).

 

I've also tried to mimic the color clearing steps with the Make Transparent plugin, but it threw me an error at times and the aspect was not quite similar whenever I got it to work. Besides, I noticed that using the plugin for a second time on an already red-free sky layer caused the transparent areas to become filled with black, whereas the remaining areas turned into jagged yellowish stains.

 

Thanks a lot one more time, MJW! You always come up with the right effect I need for special compositions. I'm super glad you're this good at implementing such nifty algorithms hi.gif

 

Color Clearer 1.1 for PdN 3.5.11.zip

Edited by Maximilian
  • Like 1
  • Upvote 2
Link to comment
Share on other sites

Thank you for the 3.5.11 build, Maximilian. I feel a little guilty, but I'm going to have an updated version of Color Clearer soon. I figured out a reasonably good solution to the problem I mentioned in my previous comment. It took me a while to figure out the math.

  • Upvote 1
Link to comment
Share on other sites

No problem. As soon as you share the updated code, I can try to update my compilation as well. I hope the new code will compile correctly for me. Otherwise, I'll have to start asking questions if I run into difficulties :)

  • Like 1
Link to comment
Share on other sites

I posted a new version which I believe makes a better choice for the adjusted color. I also added an additional control that allows a choice for transparent pixels between the original color or transparent white.

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

I've also recompiled and updated my post above with version 1.1 for PdN 3.5.11

Thanks once again, MJW! hi.gif

  • Like 1
Link to comment
Share on other sites

MJW!

 

Thank you very much for the plugin.  :pizza:  :beer:

Live as if you were to die tomorrow. Learn as if you were to live forever.

Gandhi

 

mae3426x.png

Link to comment
Share on other sites

  • 1 year later...

Thx for the Headsup, i saw that your Entry "Maximilian has a 3.5.11 version." just leads back to this thread, maybe you missed to link to a specific post? (if so check that "Share this Post" Icon in the Upper-Right of the specific Post 😉

Edit:
and for a next version you could group your Plugin under "Transparency" to reduce Clutter of the menu 😉
(instead creating your own "Color" group xP)

Edited by BlackRedDead
Link to comment
Share on other sites

  • 1 year later...

Is that possible to add a checkbox, that saves converted to alpha color to separate layer?

 

For example I have this icon, I want to change black color to white, without changing yellow logo and white outline and with converting pixel in between white-black and black-yellow (yellow-black to yellow-white, white-black to white-white)

It could be convenient to convert black to alpha, and save black to other layer, invert black layer and merge layers back together.

 

EnrichedUranium.png

Edited by JumpingCucumber
Link to comment
Share on other sites

13 minutes ago, JumpingCucumber said:

Is that possible to add a checkbox, that saves converted to alpha part to separate layer?

 

 

Plugins can't add layers, can't write to other layers, and can't write outside of the current selection.

  • Like 2
Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
1 hour ago, girlhi said:

It won't let me open ZLL files, do you know how to fix that

 

Please follow these instructions for installing plugins:

https://www.getpaint.net/doc/latest/InstallPlugins.html

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

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...