Jump to content

Two zero-alpha aeras are treated separately


Recommended Posts

paint.net 4.0.9

 

When using Magic Wand with a low tolerance (2%, for example) in a transparent white area, the adjacent transparent black area will not be selected.

Paint Bucket has the same issue.

 

I reported the issue 1 year ago (http://forums.getpaint.net/index.php?/topic/31721-two-zero-alpha-aeras-are-treated-separately/) but it has not been fixed yet. I decompiled the program, and It seems that the issue is at PaintDotNet.Tools.FloodFill.FloodFillAlogrithm.GetDistance in PaintDotNet.exe. Wonder it is a bug or feature?

Link to comment
Share on other sites

Excuse me, but what is a transparent white area? Either it is transparent or white. Otherwise, it is semi-transparent. How do you describe the problem, I can not understand it anyway. Maybe you should provide some screenshots.

Edited by IRON67
Link to comment
Share on other sites

Excuse me, but what is a transparent white area? Either it is transparent or white. Otherwise, it is semi-transparent. How do you describe the problem, I can not understand it anyway. Maybe you should provide some screenshots.

Transparent white color = set the Alpha value of White to 0

Transparent black color = set the Alpha value of Black to 0

Link to comment
Share on other sites

What skyoxZ is saying is that it probably shouldn't matter to the Magic Wand whether it's transparent white or transparent black, since they're both full transparency, but it does; with a low tolerance setting, the transparent white pixels are selected while the transparent black pixels aren't. I verified that that's true. It seems to occur with tolerances at or below 4%.

 

(This thread most likely belongs in "Troubleshooting & Bug Reports.")

Link to comment
Share on other sites

I do not see this as a bug.

 

We see 'transparent' as being visually the same. A computer does not see them at all. Instead it manipulates four 8-bit data channels (RGBA). Obviously #FFFFFF00 is not the same as #00000000 even though it appears the same to our eyes.

 

I believe that the interpretation of tolerance is correct.

 

/my2cents

Link to comment
Share on other sites

I see it as a bug, or at a minimum very unexpected behavior. No one would deny that white transparent and black transparent pixels are different internally, but it by no means follows that the Magic Wand should treat visually-identical pixels differently just because they're internally different. And if they are treated differently, they should be treated as though they're a lot different, since three of the four components are as far apart as they could possibly be. So even a high tolerance should differentiate between them.

Link to comment
Share on other sites

I do not see this as a bug.

 

We see 'transparent' as being visually the same. A computer does not see them at all. Instead it manipulates four 8-bit data channels (RGBA). Obviously #FFFFFF00 is not the same as #00000000 even though it appears the same to our eyes.

 

I believe that the interpretation of tolerance is correct.

/my2cents

Technically, I'm not sure it is good to think color #FFFFFF00 equals color #00000000 but I believe the distance between two 0-Alpha colors should be 0.

Link to comment
Share on other sites

My point was that we perceive them as being the same, but they are not.

It is reasonable to expect the Alpha channel to heavily influence/bias the tolerance algorithm however the numerical differences remain.

Remember, the Magic wand is doing a four channel (RGBA) comparison between pixels. Not a single channel (???A) comparison.
 

but it by no means follows that the Magic Wand should treat visually-identical pixels differently just because they're internally different.


Disagree. Theory: my petrol powered Honda does not attract road tax like a diesel model does. Outwardly they appear the same. Should I pay (diesel) road tax because they appear to be the same car?

Magic Wand treats them differently because they are different.

Link to comment
Share on other sites

:lol:

A beaker of water vs a beaker of acid?

My point was that appearances can be deceiving. They are structurally different.

If the magic wand could select referencing a single channel things might be different. When all four channels are used, each channel becomes part of the algorithm. Magic wand doesn't know if you're selecting for similarity of the alpha channel or the green channel.

Link to comment
Share on other sites

Appearances can be deceiving, but PDN is an image editor, so appearance matters a great deal. (In contrast to vehicles, where appearance is a secondary consideration.)

 

I wish there were more options for how Magic Wand selections are made, but there's only one, so it ought to be the most practical for the widest variety of situations. Generally -- I'd say the vast majority of times -- the user doesn't care whether a completely transparent pixel's color fields are white, black, or purple; no matter what the RGB values, if the alphas are 0, they're all transparent, and they all affect the appearance of the image in the same way.

Link to comment
Share on other sites

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

At a tolerance of 0, I would expect transparent white and transparent black to be treated as different colors. That's the whole point of using a tolerance value of zero, in fact.

 

However, at values of 1 and above, it may be worth comparing values in the premultiplied alpha color space. This would allow transparent white and transparent black to be "equal".

 

Whether it's a "bug" or not isn't really the point, in my opinion. The two questions that would guide me on this are, "what would you actually expect to happen" and "does it completely prevent you from being able to do something important/useful" (in other words, there's no workaround).

 

I've filed a bug to look into this ...

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

You might be able to work around this for the time being by adding a new layer on top of your current one and then using "All Layers" sampling mode in the toolbar. This assumes that you don't have other layers above/below that will get in the way. This should force transparent black and white to be equal values at the point where the comparison is made by the Magic Wand tool. (the math works out so that that blending transparent anything + transparent anything = transparent black)

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Whether it's a "bug" or not isn't really the point, in my opinion. The two questions that would guide me on this are, "what would you actually expect to happen" and "does it completely prevent you from being able to do something important/useful" (in other words, there's no workaround).

 

Here is how I get the issue:

In a new layer, I draw something and adjust the color using Brightness, Invert Colors, Delete or something else (the selection contains what I want to adjust and it also contains some full-transparent pixels which I thought it not matter to select them too). I have many layers like that. When merging these layers, I get a layer with some full-transparent but different-RGB pixels. Now I want to select all visible pixels in the merged layer (because I want to cut off the part of the canvas which doesn't contains anything). It seems like the best way is to select all of the full-transparent pixels and then Invert Selection, but it's not easy to do that.

Edited by skyoxZ
Link to comment
Share on other sites

You might be able to work around this for the time being by adding a new layer on top of your current one and then using "All Layers" sampling mode in the toolbar. This assumes that you don't have other layers above/below that will get in the way. This should force transparent black and white to be equal values at the point where the comparison is made by the Magic Wand tool. (the math works out so that that blending transparent anything + transparent anything = transparent black)

 

Seems not work. :(

 

Edit: It works when putting the new empty layer below the current one. Thank you :D

Edited by skyoxZ
Link to comment
Share on other sites

Hello skyoxZ,
I have not experienced your exact problem but have had problems with the 'hidden' colour values in zero alpha areas in the past.
(see post #22, page 2 of this thread http://forums.getpaint.net/index.php?/topic/24769-gradients-galore-another-update-2242016/page-2)

I made a 'clean clear' option in my 'Object2Colour' plugin to help deal with this. It sets zero alpha pixels to transparent white (BGRA = 255,255,255,0).
http://forums.getpaint.net/index.php?/topic/25420-object2colour/

When a new layer is created it is transparent white (BGRA = 255,255,255,0), however some plugins use transparent black to 'erase' areas (BGRA = 0,0,0,0) and others leave the colour information and just set the alpha to zero.The idea being that the information can be retrieved later by increasing the alpha.

It seems, the colour of transparent areas is complicated! ;)

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

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.

 Share

×
×
  • Create New...