Bug 343365 - magic wand selection is broken for 16 bit/integer images
Summary: magic wand selection is broken for 16 bit/integer images
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools (show other bugs)
Version: unspecified
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL: http://i60.tinypic.com/2dljazm.png
Keywords:
: 335102 343285 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-01-27 11:40 UTC by kalia24
Modified: 2015-02-03 19:12 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kalia24 2015-01-27 11:40:30 UTC
Version 2.9 beta 2.
As can be seen in given link - selecting the blue part (it's a transparent part of the yellow layer with blue layer under it, but selection was limited to the yellow layer) resulted in the above.

Reproducible: Always

Steps to Reproduce:
1. Make partially transparent layer with some flaws around/inside the main shape and fuzzy edges.
2. Try wand tool to select the transparent part.

Actual Results:  
As seen in picture - parts of both transparent and opaque area are selected. Areas with very low opacity are not selected, but those with quite high one - are.

Expected Results:  
Either only the area with 0 or very low opacity selected or everything with opacity lower than 1 selected.

No idea why it happened - seemed to work well before...
Comment 1 Halla Rempt 2015-01-27 14:39:36 UTC
Could you attach your original .kra file for me to play with?
Comment 2 kalia24 2015-01-27 15:11:19 UTC
(In reply to Boudewijn Rempt from comment #1)
> Could you attach your original .kra file for me to play with?

Sent via mail.
Comment 3 Halla Rempt 2015-01-28 09:31:42 UTC
Okay, something weird is going on. I've checked in Photoshop CS2, and if you limit the magic wand to the current layer, you won't get a nice, sharp selection either, for that you need to sample all layers. If you enable that in krita, you get the same result as in photoshop. With sampling only the current layer, photoshop definitely has a kind of fringe around the yellow image. Interesting, too, is that the blue background is a bit transparent after converting to psd, but that's another thing.

If I convert your image to 8 bit/channel, I get the same result as with magic wand/limit to current layer as photoshop, which suggests to me that photoshop actually converts the pixels to 8 bits/channel when creating a selection, which means that Krita might just be more accurate.
Comment 4 Halla Rempt 2015-01-28 09:40:28 UTC
Okay, I can also confirm that 2.8 doesn't have the problem, so it's a regression.
Comment 5 kalia24 2015-01-28 11:19:51 UTC
(In reply to Boudewijn Rempt from comment #3)
> Interesting, too, is that the blue background is a bit transparent
> after converting to psd, but that's another thing.

That's my fault when making the image in fact - I didn't look at the set-up of new image and for some reasons default for me was 90% opacity for new image background... Realised that when exporting this one after finishing and making new one.
Comment 6 Halla Rempt 2015-01-28 14:23:27 UTC
Ah, right, I see that in the kra file too, now. I'm now trying to find out when we regressed.
Comment 7 Halla Rempt 2015-01-28 15:07:45 UTC
Okay, this behaviour was introduced with 12f7d13838da7a02504ff621a7243c9b740520ae

"Connect the Scanline Fill algorithm to KisFillPainter" -- though at that exact commit, I cannot reproduce the bug because the algorithm gave an error:

Error FATAL: The backward interval cannot fully reside inside the forward interval sending event 2 to object
Comment 8 Halla Rempt 2015-01-29 10:48:00 UTC
*** Bug 343285 has been marked as a duplicate of this bug. ***
Comment 9 Dmitry Kazakov 2015-02-01 14:14:28 UTC
Reproduced it. The fix will be tomorrow.
Comment 10 Dmitry Kazakov 2015-02-02 10:25:11 UTC
Git commit d6b43848e24a833304e4670d3212a1ce4cfc34ff by Dmitry Kazakov.
Committed on 02/02/2015 at 11:24.
Pushed by dkazakov into branch 'calligra/2.9'.

Fixed flood fill in 16 bit mode

Well, 'reinterpret_cast<quint32*>(pixelPtr)' in a templated code was
obviously wrong :(

M  +1    -1    krita/image/floodfill/kis_scanline_fill.cpp
M  +3    -2    krita/sdk/tests/testutil.h
A  +-    --    krita/ui/tests/data/flood_fill_16bit.kra
A  +-    --    krita/ui/tests/data/selection_manager_test/scanline_16bit_thres_20.png
A  +-    --    krita/ui/tests/data/selection_manager_test/scanline_8bit_thres_20.png
M  +63   -0    krita/ui/tests/kis_selection_manager_test.cpp
M  +2    -0    krita/ui/tests/kis_selection_manager_test.h
M  +5    -4    plugins/colorengines/lcms2/LcmsColorSpace.h

http://commits.kde.org/calligra/d6b43848e24a833304e4670d3212a1ce4cfc34ff
Comment 11 Halla Rempt 2015-02-02 10:26:39 UTC
I'll make a new windows test build now :-)
Comment 13 Halla Rempt 2015-02-03 19:12:53 UTC
*** Bug 335102 has been marked as a duplicate of this bug. ***