Idea for a new dt module - Posterize

As far as I’m aware, there’s no module for doing posterization directly in darktable. It can be achieved in Tone Curve and perhaps other modules, though it’s not quick.

Here are a few simple experiments with posterization -

A dedicated module for creative effects could generate a transforming curve internally and apply this to one, two or all three channels of an image. It would be a function with steps.

The user would choose the number of levels (steps) of posterization. The first might start at (0,0) or maybe it would be useful to specify an offset as above.

Each step could be a horozontal and a vertical - (a) ; or these could be angled (b). And a further user-supplied “smoothing” value could choose between no smoothing (a) and some degree of smoothing (c).


The channels to be posterized would be R, G, B, L, a, b. Others? hz etc? I see in Tone Curve you can apply to an individual Lab channel but not individual RGB I think, at least not in my experiments. Is there are reason for that? I’m at the limits of my understanding here, however I’m guessing a module can transform the input space/channels to another config for the posterization, then transform back for the next module in the pipe. Presumably posterization would be best later than Filmic. I don’t know what 5 (say) levels would mean in an unbounded space.

As with most modules, you would be able to work with masks.

I think that’s about it. Do you think this could be a useful addition to dt?

1 Like

I think it would have made my work easier (see the other thread Pure Black and White). I also think fiddling with the curves and getting the transitions between the zones the way you want it is complicated.

I think this would be also pretty cool if done in scene-referred JzAzBz or even better, JzCzhz. For the Jz channel one would choose the step size (in Ev) rather than the number of steps. For the Cz I suppose one could set either the step size or number of step (since that is a bounded value). For the hz one would have to take care of proper modular arithmetic in the hue ring (i.e. to properly wrap at 360 degrees). An offset would be useful for the hz to define what the resulting colors actually become.

Wouldn’t such “special effects” be better off in G’MIC? The possibilities for effects are almost endless and would make darktable rather cluttered.


Great!, some comments!

@Juha_Lintula -
I want to promote Posterize of course!, but I’m not sure how it would help with your Pure B&W, where it seems to me placing the cut-off point is crucial. I remember seeing tools for doing this, maybe Photoshop a long time ago, perhaps Rawtherapee… high pass / low pass? Not sure.

When you say about fiddling with curves, you are referring to the use of RGB curves, right?

@flannelhead -
Looks good to me, thanks. I didn’t think through the hue aspect. So it’s more like dividing a circle into segments than a line into steps. And then specifying a rotational offset.

@Thomas_Do -
It saves the learning curve and inconvenience of using multiple apps.

You are right, it requires placing the cut-off where you want it. For a generic module, a number of steps would be a better approach, otherwise the UI would become too cluttered.

And to your question:

the answer is yes.

The cutoff adjustment (or a generic luminance offset adjustment) can be realized by placing an instance of the exposure module before the proposed posterization module.

1 Like

If you run windows you can do this I believe in picture window pro 8. I will check but it has a lot of features and a cool almost node like workflow with connections and branching…some elements of the GUI are non standard but it is written by one of the original lotus 123 creators and while not open source it is free…

See page 121 or 122… @RawConvert it also has a posterize transform and step curve in the curves transform

EDIT sorry I forgot the link to the page reference…

Almost equal as I post in Pure Black and White the posterize effect can be made easy with the tone curve and blurs modules. Personally I don’t think a new module (posterize) is needed. Maybe using G’MIC is better for that kind of effects, and darktable must be the link between the apps.

This is a screenshot of the posterize effect.

This is another sample more aggressive



Well, that’s two modules to adjust just for starters.
The problem for me with curves is that you have to make a guess about the number/size of steps, then set them up by dragging points, and see what you get. If you then fancy fewer steps, say, you have to start again. It’s slow and cumbersome.
With a dedicated posterize module, you’d simply change the no. of steps from 4 to 3, say, and you’d quickly see the result. I’ve used posterize functions previously, and it’s quite an experimental process. It’s hard to guess what the result will be. You choose a photo that you think could become an interesting image with posterization, and experiment. Hence the desire to have various channels available for use, and of course the no. of levels.
Your first example is fine, with 7 levels. But you can’t quickly see what it would be like with say 5 levels. And from experience, it can be very different.
I know little about G’MIC but it seems to be a programming language essentially? I know it can do clever processing, but I (and I would guess many others) simply don’t want to get into that.

1 Like

So yes, sounds like easily adjustable black and white splitting could be achieved with 2 levels of posterize and the Exposure slider.

In case people think the smoothing looks difficult, I’m not imagining any curve fitting, just some simple smoothing along the lines -
Y(n) = .06y(n-2) + .14y(n-1) + .6y(n) + .14y(n+1) + .06y(n+2)
plus a control to choose from a handful of predetermined patterns of coefficients in order to give varying amounts of smoothing (perhaps).

G’MIC can be used that way, but it also exists as a plugin for e.g. GIMP and Krita. This may be an easier way to use it.

Also, I wonder if this kind of operations are really suitable for direct inclusion into darktable. darktable still presents itself as a program for raw development. Posterisation and such feel to me like they go way beyond that.

Just in case that a dev show interest in create a posterize module I made a Mock up with some parameters and integration with dt.

This is just an idea, maybe other parameters must be important too. I don’t know what other options can be place to improve the posterize effect.

@rvietor , the headline on says “darktable is an open source photography workflow application and raw developer”. I think it’s a tricky question to say what that scope is. dt has modules which can arbitrarily change colours in an image. @aurelienpierre has introduced colour grading and censorize (blocking out sensitive areas). @s7habo produces great images using the Bloom tool - Bloom example -

There’s also a module for putting a frame around your image.
You could have a long discussion about where “raw development” ends and general image processing begins.
I think the bottom line with posterize is that lots of users would get pleasure and satisfaction from it.

@difrkaguilar phew! that’s quite comprehensive! I’m glad you’re interested!
I think you’ll need to explain some of the inputs though!
It seems based around RGB. I’d seen it as having 3 channels and you choose what these are, like in tone curve, so the gui labels could be simply channel 1,2 & 3 rather than RGB. The channel choices at outset could be ? -
R G B or L a b or jz cz hz

I hope there will be interest in posterize and the devs will consider building it. Overall though, I think we should leave detailed design and gui to them.

1 Like

Can G’MIC be used as a plug-in to darktable, like GIMP? If not, perhaps that could be done.

I think there is huge mileage in making tools interoperate, rather than trying to make all tools do what some other tool can do.

Might need a source for that :slight_smile:
I have to admit my first thought was this sounded very niche. But if enough users want it, then that’s an argument for its inclusion. The majority of the special effects modules in DT can be used for raw development as well as creatively. Even liquify can be used to straighten a curved horizon.

If posterize also has a utilitarian function and not just a niche creative tool, then it would be another tool in the toolbox.

1 Like

I’m working in another proposal of the posterize module. As soon as finish I’ll post it.

Gimp is a raster app, darktable is a non-destructive editor. Having the whole stack of image filters recomputed on-the-fly on each and every pan/zoom, including Gmic filters if it happens, is going to be painfully slow. Also, Gmic doesn’t do OpenCL, so good luck with that.

Making all tools interoperate, while sounding good on paper, is only going to turn the slowest into performance bottlenecks for all the others. The ability to run anything on GPU is not really standard in FLOSS image apps.