Bug 402834

Summary: Add dithering to gradients
Product: [Applications] krita Reporter: Raghavendra kamath <raghu>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: wishlist CC: griffinvalley, halla, karl
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: gradient banding

Description Raghavendra kamath 2019-01-03 17:11:13 UTC
Created attachment 117268 [details]
gradient banding

SUMMARY
When applying multiple successive gradients (foreground to transparency) one above other, we get bandings and undesired color variations. According to discussion on IRC this is due to dithering problem.

the bug is seen prominently when working with colors close to black and you draw it on a new layer. Drawing on an opaque white layer reduces the banding a bit.

I have attached a png file with multiple gradients you can see banding in the middle, and if you zoom in you can see reds and greens in the colors. this becomes a hassle when color picking and painting too.

STEPS TO REPRODUCE
1. Open a New document in Krita, switch color to close to black near red spectrum.
2. Choose the gradient tool and go and adding radial gradient successively one above another


OBSERVED RESULT
Bandings appear when applying successive gradients

EXPECTED RESULT
gradients should be dithered and smooth gradation should be produces

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.14.4
Qt Version: 5.12.0
KDE Frameworks Version: 5.53.0
Comment 1 wolthera 2019-01-03 17:30:17 UTC
We'll need to look into high bit gradients and then dithering for converting them to 8 bit to really resolve this.
Comment 2 Halla Rempt 2019-01-06 09:27:48 UTC
Setting to wish: dithering is a new feature. Maybe we can just nick gimp/gegl code for this?
Comment 3 Raghavendra kamath 2019-01-07 06:07:34 UTC
Sorry for taking this different tangent. I think dithering should be in how colors are mixed and shown on screen and not just in gradients.  for example there will be banding when you convert from 16 bit to 8 bit and sometime the look of the image will change drastically due to this. So i think dithering should be added to converting images , and if possible everyplace where there is a possibility of seeing a banding.

A work around for this situation is to add noise spread filter from gmic
Comment 4 Halla Rempt 2019-01-07 10:12:29 UTC
It turns out we have an abandoned branch and phab task for this alread: https://phabricator.kde.org/T863, where Wolthera has also mentioned other places where dithering should be used when working in 8 bit.
Comment 5 Halla Rempt 2020-05-15 10:48:15 UTC
And we already had a wish for this...

*** This bug has been marked as a duplicate of bug 343864 ***