Flood filling on antialiased raster?

Hi there,

I might be asking for something completely stupid here, but say I’m drawing a shape.

Then let’s suppose I want the interior of the said shape to be of a given color. I would then use the flood fill tool, which results in… this…

Of course, increasing the color tolerance will make it look a little better, but not a lot. So my question is, is there anyway I can floodfill of a way it tints the colors that are in the tolerated range? Or will I have to use vector graphics? (Which would imply re-drawing a project I started but taking into account the unstability and bugs of the vector graphics…)

Thank you in advance for all help.

Here are two random shapes filled with tolerance 40 (left) and 100 (right).

I’m afraid this is the best we can offer at the moment, but we are working on a better solution. When that will be, I don’t know.

I’ve never user the vector layer myself, so I can’t advice on that.

billede Scaled down to 1:1, the 100 % doesn’t look that bad…

I would personally draw the lines on one layer, then draw along the lineart with the same color you fill with, with no anti-aliasing on a layer below and fill there instead. Then you’ll avoid the anti-aliasing issue and you can control how much you want filled.

@CandyFace Per your example workflow, Pencil used to have a capability that fits perfectly with it as mentioned here https://github.com/pencil2d/pencil/issues/1207

Regressing / re-implementing that feature would help avoid having to redraw the lineart on the color layer from your example workflow.

To “avoid” the anti-alias there are two ideas that occur to me.

  1. To preserve the per-pixel-fill expansion when clicking on a filled area
  2. Or introduce a way to add antialias to “jagged” lines. We can try using the OpenToonz algorithm or another algorithm I found from a Japanese plugin for After Effects (not the OLM one though)

This way we would have the simplest and most effective way to color layers like this:

  1. Create separate lineart and color layers in advance
  2. Create an anti-aliased stroke on the lineart layer
  3. Use the fill tool on the lineart layer and let the color “bleed down” to the fill layer while ignoring the anti-alias.
  4. Optionally. If #2 was created without anti-alias, then add the anti-alias to the lineart layer after all colors have been applied.
1 Like

Thank you very much, I suppose that’s my best option.

@Laf Unfortunately right now coloring as you described is simply not as effective as it could be in Pencil2D, there are ideas, plans and existing contributions to improve this, but my personal recommendation is that if you’re going to animate in pencil2D only do the “roughs” / sketch animation there, and use a program like Krita or Opentoonz to perform the coloring.

Both these tools are also free and have extended coloring capabilities. Opentoonz particularly has been used for that purpose consistently so it has a solid coloring workflow.

In normal circumstances and if the animation is short, you can do as CandyFace mentioned, coloring on an extra layer and only drawing with the fill color the outer border using a tool (e.g Pen) with the anti-alias checkbox turned off. It’s an excellent technique.

But if the animation is too long (above x minutes) I’d recommend using tools with further capabilities in this area.

Thank you for these recommendations. In case you wish to improve the Pencil2D bucket fill, my simple suggestion for this(I don’t know if it’s possible but I believe so, since all floodfill algorithms work similarly):

Considering Pencil2d’s antialiasing is seemingly done on the alpha channel, the floodfill could have an option which makes it fill over all values that are whithin a certain threshold of transparency. The color would then become the one the users floodfills with, only it’s darkened by as much as the transparent pixel was for the color the user clicked on when initiating the floodfill. Then again, I don’t know how the Pencil2D fill works and if that is possible. And you might already have thought of it. It’s just a suggestion made in the hope it helps.

1 Like
Imprint