Cache layer information when using wand/fill tool with reference color layers

I am working on a complicated picture in a high bit depth with large dimensions. With 8 layers (out of 60+) tagged as blue, and the fill tool set to only reference blue layers, the fill operation takes 10-20x longer than either ‘sample one layer’ or ‘sample all layers’.

I believe this may have something to do with Krita having to generate the reference ‘layer’ out of all the blue layers first, and then applying the fill. I believe this could be sped up by some sort of caching of this generated layer, so that consecutive references to it do not have to regenerate this information. Changing layer color tags can clear the cache or something.

This could be entirely wrong, it may already do this, or I very likely don’t know what I’m talking about. In that case consider it a bug report.

You are correct, the reference layer used to check the color similarity is re-computed every time a fill (contiguous selection) operation is started (unless the active layer is used as reference).

That’s something I wanted to tackle, so please fill a bug report and I’ll assign it to me to try to solve the issue.


If you’re the one who originally added the ability to reference specific color layers on wand/fill, I just wanted to say that I don’t think you understand just how much of a help it has been in my daily workflow. By this point it has likely saved me several dozen hours of combined time vs manually selecting areas.

Bug made

1 Like

I didn’t add the feature. I think it was tiar. But since I made some changes to the tool, I’ll try to solve this to make it even better.


That was me :slight_smile: Nice to hear that! And yeah, I just did it in the way that made sense at the time.

@Deif_Lou it would probably make sense to make it a lazy initialization situation, as in, only caching it after it’s used the first time, otherwise it could take up plenty of space (a whole projection of the document, after all) without being sure if it’s even needed.

1 Like

I made a MR that tries to solve this issue: Cache the reference paint device in the tools that use reference layers (!1538) · Merge requests · Graphics / Krita · GitLab