How do I change all pixels of the same colour to another colour?

I do a lot of pixel art using Krita, because it’s easy to make a complete tileset for RPG Maker all in one document (eg. outdoors A2 which are ground tiles). However, I have just spent the afternoon using the flood fill tool to re-colour my grass texture a couple of times so I have a variety of grasses, and I was wondering if this process could be sped up significantly by changing the colour of all pixels of the same colour simultaneously within a selected area? I seem to have done it accidentally for the lightest colour in my default grass, but no idea how I did it or how to repeat that for the other two colours. Does anyone know how this is done on purpose, because it would save me literally hours of work.

Hello and welcome to the forum :slight_smile:

That would be quite easy to do, especially for pixel art.

Use the similar Colour Selection tool, with Tool Options Action:Replace, Threshold set to 1, antialiasing disabled, then click on a pixel that has the colour you wish to replace by another colour.
That will select all pixels of that colour in the layer.

You can further refine that selection by using the Freehand Selection tool with Action:Intersect and draw a boundary around the region you wish to limit the selection to.

Then, I’d suggest that you make a new layer above the artwork and use the Flood Fill tool with What To Fill: Current Selection and fill it with the chosen colour.
That will let you see the effect without actually making any changes to the existing artwork.
You can then try a Fill with a different colour instead, if you want to.
Then, you can merge the filled layer with the artwork layer to finalise your choice of replacement colour.

Learning the detailed operation of the selection tools, their actions and modes and adjustable properties is very useful.

1 Like

Just for info, in the next Krita 5.2, this same functionality is implemented in the fill tool itself, so it will take less steps.

5 Likes

It just keeps getting better and more capable as time goes by :slight_smile:

If you have lots of colour replacement to do then it would be worthwhile getting the nightly Plus/Stable version which does include this new functionality in the Fill tool.

It has a Threshold slider for colour discrimination and you can limit the region affected by enabling the Use Selection as Boundary option, in a similar way to my description of using the Freehand (or whatever) selection tool with Action:Intersect in my first reply.
It’s all good stuff.

The latest nightly Stable/Plus version is here for Windows:
Krita_Stable_Windows_Build [Jenkins]
I’d suggest that you try the portable .zip package first because this will not replace your existing installed version.

1 Like

Antialiasing is disabled anyway, because you don’t use it for pixel art it would make it blurry. I just tried, had to undo because it doesn’t select one colour of pixel, it selects two different colours. Is there any way to make it choose ONE colour to change, at a time? As it stands I’m trying to change two different but similar shades of green, one I need to go a light grey, the other needs to be light blue. I might just end up doing this the long way, a pain but for some reason it won’t do what I need it to. Thanks for the help anyway though :slight_smile:

Oh, I got it now, I had to reduce fuzziness to 0, but it only works if I cut and paste onto an empty document first, else my default grass tile also gets coloured. Even with copy and paste though it is far far faster… thank you :slight_smile:

I don’t understand why you need to do that and can’t think of why you should have to.
It would be useful if you could post illustrative images.

Where do you see this ‘fuzziness’ control?
I seem to remember that ‘fuzziness’ was a parameter in some tools when using an old version of krita.
As far as I can tell, the current version (5.1.1) doen’t have any ‘fuzziness’ control anywhere.
It has ‘Threshold’ controls in various places.

I seem to have got confused here because the Contiguous (colour) Region fill is already available in the Fill Tool.
Correction:
A Similar Colours option is now available in the nightly Next build:
Krita_Nightly_Windows_Build [Jenkins]

It should be on krita next.

1 Like

Yes it is :slight_smile:

Windows portable .zip package available from here:
Krita_Nightly_Windows_Build [Jenkins]

I don’t understand why you need to do that and can’t think of why you should have to.
It would be useful if you could post illustrative images.

Because it selects all pixels of the same colour on the entire page, not just the specific section I am working on. Doesn’t matter though, it’s still saved me a whole chunk of time.

I must be using an outdated version if ‘fuzziness’ isn’t on the most up to date. Again, it doesn’t bother me, the program is now doing what I need it to do.

It’s a bit complicated at first but not too difficult when you’ve explored the possibilities and had a few practice sessions. :slight_smile:

The new Fill Tool functionality in the 5.2 Next nighly builds makes it even easier by using Use Selection As Boundary with colour discrimination/replacement built into the Fill tool.

Maybe but you could have it do so much more for you.

Select the area you want before, then on the Similar Color Selection make sure to select the Intersect mode (the second icon highlight above) before using the tool.

Or you can use Krita Next like Ahab suggested before.

Cheers

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.