Bug 438799 - Anti-aliasing + Fuziness in Contiguous Selection tool is causing huge area to be selected as semi-transparent pixels
Summary: Anti-aliasing + Fuziness in Contiguous Selection tool is causing huge area to...
Status: ASSIGNED
Alias: None
Product: krita
Classification: Unclassified
Component: Tools/Selection (show other bugs)
Version: 4.4.5
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Tiar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-17 12:10 UTC by Tyson Tan
Modified: 2022-01-20 02:14 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Sample of copied pixels using Contiguous Selection with Anti-aliasing ON and Fuziness set to 8 (2.96 MB, application/x-krita)
2021-06-17 12:12 UTC, Tyson Tan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2021-06-17 12:10:48 UTC
SUMMARY
Anti-aliasing + Fuziness in Contiguous Selection tool is causing huge area to be selected as semi-transparent pixels

Tested with 4.4.5 appimage and 5.0 nightly.

STEPS TO REPRODUCE
1. Create a new document
2. Fill the canvas with Gradient
3. Use Contiguous Selection tool, turn on Anti-aliasing and set Fuziness to 8, Growing to 0, Feathering to 1.
4. Select some area on the Gradient
5. Ctrl+C, Ctrl+V, now the selection has been copied and pasted as a new layer.
6. Hide the original gradient layer and also hide the background.

OBSERVED RESULT
Almost all of the pasted pixels are semi-transparent. This is not ideal to work with, because we can't pick color from it reliably. Unwanted color from lower layers that once was blocked, now blending with everything else of the pasted layer.

I think the current logic is to treat every bit of deviation from the sample point as somewhat transparent.

EXPECTED RESULT
Ideally:
1) Fuziness should affect how large the selection becomes;
2) Anti-aliasing makes a fixed, 3-5 pixels-wide fading zone around the selection's outline, which is semi-transparent.
3) Everything else inside the selection should be 100% Opaque.
Comment 1 Tyson Tan 2021-06-17 12:12:29 UTC
Created attachment 139432 [details]
Sample of copied pixels using Contiguous Selection with Anti-aliasing ON and Fuziness set to 8
Comment 2 Ahab Greybeard 2021-06-22 09:44:21 UTC
The 'Base Gradient' layer has semi-transparent pixels in it so I'd expect the copied selection to have those semi-transparent pixels as well.

Because the selection tool applies transparency to indicate how far away from the clicked pixel the included pixels are (in terms of being equal to it), then there is additional transparency applied, depending how far away from the clicked pixel they are in terms of matching it.
I think this is the standard behaviour of this selection tool.
This seems to result in coarse banding of the copy/pasted alpha values.

To disable the additional transparency applied by the selection tool, it looks like you can enable the 'Use selection as boundary' option and turn Anti-aliasing off.

Does use of 'Copy Merged' (Ctrl+Shift+C) instead of Ctrl+C deal with the problem  of the copied colour not being as was originally seen on the canvas?

I may have misunderstood some or all of this and there are some complicated interactions going on.
Maybe it needs a discussion topic on krita-artists.org?
Comment 3 Tyson Tan 2021-06-22 09:51:38 UTC
Thanks Ahab.

"Use selection as boundary" ON + Anti-aliasing OFF did not work.

Ctrl+Shift+C worked as intended.

I can put this on the forum for further discussion.
Comment 4 Tyson Tan 2021-06-22 10:03:50 UTC
Wait, it seems that Anti-aliasing must be OFF for it to work anyways...
Comment 6 wolthera 2021-09-09 13:18:23 UTC
There seem to be two problems here:

1. Anti-aliasing is confusingly named for it's purpose, Tyson is confusing it with 'feathering radius'. Perhaps something like 'If possible select extra pixels as transparent' might be more suitable.
2. Selection as boundary isn't disabled when antialiasing is on?

Assigning this to Tiar
Comment 7 Tyson Tan 2021-09-09 13:30:24 UTC
Actually, I played enough game to not confuse AA with feather. I came from an era before AA and saw AA becaming a thing. I know exactly what they are:

Anti-aliasing is to do interpolation and smooth out jagged pixel edges. 
Feathering is to blur like Gaussian blue filter.

The thing is, these options are not behaving as expected in Krita's Contiguous Select Tool. We are so confused as nobody in our local community seemed to be able to understand their synergy, while everybody knows what they supposed to be.

The function is the issue here, not the label.
Comment 8 tomtomtomreportingin 2021-10-06 07:10:39 UTC
I just noticed this myself. Seriously unexpected behavior, or at least I don't see how this behavior could be useful, especially since selection tools have anti-aliasing enabled by default... I've long noticed that similar behavior occurs with the Fill tool (where color somewhat bleeds into other shades), and I don't think there's a workaround/setting for that.
Comment 9 Deif Lou 2022-01-18 11:36:56 UTC
Tyson Tan, is the addition of the softness parameter a solution to this problem? It allows to specify how soft/hard is the transition between the color where you clicked and the non-similar colors (up to the threshold value).
Comment 10 Tyson Tan 2022-01-19 15:49:03 UTC
I don't think that is the solution I expected. Although I can fill the selected area with a solid color when Softness is set to 0, it required too much tweaking to make a useful solid selection with fuzzy transparent edge. 

Krita's Contiguous Area Selection tool (and Fill tool) is overwhelming its users with excessive controls. Maybe it makes sense from a programmer's point of view, but it makes no sense from a user's point of view. It's not straightforward. The default value is useless. It makes the tool feel broken. It's impossible to teach oneself to them because they produce somewhat similar result.

The co-existence of Fuziness, Softness, Feathering in one place is super confusing. These words LITERALLY mean the same thing! If you insist to keep all these options, they need tooltips to explain what they actually do and why they are different. 

My recommendation is to simplify these options into ONE option:

Fuzziness: How many pixels from the edge of the selection to taper into transparency (default: 8)

Maybe you can add an option to control how the taper works (linear, gaussian, default: linear), and an "Advanced" checkbox to enable the extra controls (default: OFF).

If nothing can be done, at least make the default values behave like PS/GIMP, and add a "reset value to default" button, so we can have a safe reference point.
Comment 11 Tyson Tan 2022-01-19 16:07:29 UTC
Look no further than Krita's own Similar Color Selection tool. It has ONE Fuzziness option, it is all we need! Easy to understand and use.

I fear if we keep making Contiguous Selection and Fill tool more cluttered, they will become one of the major issue for people to adopt Krita.

Even as a long time user, I have stopped using Contiguous Selection tool and Fill tool altogether for a long time now. I just could not get what I want in an easy tweak.
Comment 12 Deif Lou 2022-01-19 22:23:22 UTC
These are my thoughts:
- I'm not insisting on anything.
- I added the softness option for two reasons:
    1. There was no way in the fill tool to make a aliased fill without selecting the fast mode. But selecting that prevents you from using other features, like filling with a pattern.
    2. The antialias option in the contiguous selection tool was not really true antialiasing. It just marked if the selection should retain the semi-transparent pixels or make them opaque.
- The flood fill algorithm used in both tools does not have anything to do with antialiasing. So one should not expect that result when using those tools. Photoshop kind of fakes it, but it is not true antialiasing. For example, if the magic wand produces a straight vertical edge, it "blurs" it by 1 pixel, but true antialiasing wouldn't do that. I think I know how it does it.
- The default value for softness I chose was that way to make the tools behave as before by default.
- I agree that the options in the tools are confusing as well as the naming.
- I think that the softness option is useful for example if you want to make a soft selection or a fill that is not equaly soft in all directions, guided by the reference image. Maybe it should be renamed to something like "strength", "fastness", "contrast", "spread" or something like that.
- If you simplify the options in one, then there will be users that will complain. You only will be able to do a subset of the things you are able to do.
- What you propose for the one-option-fuzzyness can be kind of achieved right now as a combination of extend/contract and feathering. You have to select 0 softness (aliased) and: a positive extend and the same number for feathering if you want the semi-transparent area outside the selected region; negative extend and the same number for feathering if you want the semi-transparent area outside the selected region; 0 extend and a feathering if you want the semi-transparent area around the selected region contour. As you can see there are multiple implementation options just for that feature. If we choose one, some users are going to want another. I know it is kind of messy and that needs some knowledge of how the options work. But something similar to this is present in the drop shadow or glow layer effects as the spread/size pair and nobody complaint.
- I don't think the addition of new options will be one of the major issues for people to adopt Krita. I think that when tool presets become a thing, the more options the better, since then the user could benefit from several flavors of fill tool or contiguous selection tool without worrying about the technicalities if some tool presets are shared as bundles, just like the brush presets, but that's my opinion only.
- I think that we can start by remaking the tool options paner for those tools. Maybe separate the options in sections, something like:
    * Region Selection (options related to how the region is selected)

        * tolerance slider (the threshold, I like tolerance better for some reason)
        * spread slider (what softness does right now)
    * Fill type
        * combo with: selection
Comment 13 Deif Lou 2022-01-19 22:31:53 UTC
Sorry, for some reason the message got posted before I finished it. I was saying:

- I think that we can start by remaking the tool options paner for those tools. Maybe separate the options in sections, something like:
    * Region Selection (options related to how the region is selected)
        * fast mode
        * fill entire selection
        * use selection as boundary
        * tolerance slider (the threshold, I like tolerance better for some reason)
        * spread slider (what softness does right now)
    * Fill type
        * combobox with: solid color, pattern
        * pattern scale
        * pattern angle
    * Postprocessing
        * extend/contract
        * blur
    * Reference Layers
        * reference layer combobox
        * labels combobox
    * Continuous Fill (new feature that allows to fill several regions by click&drag)
        * combobox with: any region, similar regions only
Comment 14 Tyson Tan 2022-01-20 02:14:40 UTC
Grouping them sounds like an improvement. But I still think it's just too many options for a dang "magic wand" tool. 

Take cameras for example. They all have an "Auto/AF" mode and defaults to it. It has no options -- but that's fine -- because most people only need to take a quick shot and be satisfied as long as the subject is in focus and the color is somewhat appealing. If you force them to use the "M" mode with manual focus, they won't be able to take a usable photo at all.

In fact, that's a real story from the chef of a restaurant I often eat in. It happened just last month, he saw me changing lenses of my camera, so he complained to me his new bought camera cannot focus and is too bright or too dark, and now it's collecting dust. What happened was he unknowingly set it to "M/MF" mode.

Similarly, from what I heard from my local community, people are constantly getting confused when using Contiguous Selection and Fill tool because nobody can tell what's going on with the settings, and the default settings is just not doing what a "magic wand" tool is supposed to do. This is quite enough to render them useless for these users, and I'm certainly one of them -- despite understanding the options, they are not suitable for a quick glace and fast configuration.

That's why I suggest a simpler "Basic" state, with only "Grow/Shrink" and "Fuziness" available. Advanced users can use an "Advanced" checkbox to enable extra options, so nothing is lost for them.

I think the advanced users are often vocal with their specific needs. But the majority of our users are not so advanced, and they usually don't make their opinion known. Looking at the artist interviews on Krita.org, most of them don't look like they can handle the current level of complexity, or making use of those advanced features. I think we should take them info consideration when designing Krita's UI.