Bug 457820

Summary: "trim to selection" not working with contiguous selection tool, before or after inverting
Product: [Applications] krita Reporter: Erik Knepfler <knepfler>
Component: Tool/AssistantsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal Keywords: triaged
Priority: NOR    
Version First Reported In: 5.0.6   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: example of image that will not trim

Description Erik Knepfler 2022-08-13 01:22:34 UTC
Created attachment 151296 [details]
example of image that will not trim

STEPS TO REPRODUCE
1.   open png with circle image inside empty/transparent bg canvas
2.   use contiguous selection tool to select empty area around circle.  optionally invert selection, makes no difference
3.   Image > Trim to Selection

OBSERVED RESULT
nothing

EXPECTED RESULT
image should trim

SOFTWARE/OS VERSIONS
Windows:  11

ADDITIONAL INFORMATION
Comment 1 Ralek Kolemios 2022-08-16 11:33:31 UTC
Can confirm this happens on nightly appimage builds.

Further info:
Using the box select tool set to 'intersect' and covering the entirety of the selection fixes this state and allows the original shape to be trimmed to.
Comment 2 Dmitry Kazakov 2023-06-23 12:00:09 UTC
Git commit d361e80ffa4676619a242ac3b53b27bd1ec89761 by Dmitry Kazakov.
Committed on 23/06/2023 at 11:58.
Pushed by dkazakov into branch 'master'.

Fix Invert Selection to behave in a bit more sane way

If possible, we shouldn't change the default pixel of the selection,
since it "breaks" selectedExactRect() easily.

M  +27   -1    libs/image/kis_selection_filters.cpp

https://invent.kde.org/graphics/krita/-/commit/d361e80ffa4676619a242ac3b53b27bd1ec89761