Saturday, 2 July 2016

Manual Posterization

In todays tutorial im gonna show you how to posterize an image manually.
This technique has several usages that you can apply to a lot of projects.

One application is for making stencils. It gives you more control than using Contrast or Quantizing your image.

Another application is using the posterized image as a base that you can trace in Inkscape and then modify with node editing.

You can also use it to apply textures, like hatchings, to an image or create a pop art effect.

As with most projects, the image you use is crucial. Look for a sharp image that has good contrast and lighting, and not too small.
Desaturate it and if needed, add some Contrast or Brightness.

Im using an image of Marilyn Monroe from
Its 1359x1920px.

1. Remove the background with any technique you like. I made a mask in Inkscape, because the Path (Bezier) Tool is very easy to use, so all i had to do is export the mask-image in the correct pixelsize and open it as a layer in Gimp.

You can download my mask here.

If you use a selection to render your image, just invert the selection and fill with white. Deselect, invert the image so that you get a negative and jump to step 3.

Also make sure you save that selection to a channel for future use !

You can use as many colors as you like for your posterization, but between two and five seems like a good value. The famous 'Obama Hope' poster by Shepard Fairey has five colors (actually four plus one additional tone that is achieved by mixing two colours).

2. Im going with five colors.

Preparing the mask

a) Add a layermask to your image.

b) Copy the mask layer and paste it into the layermask. A floating selection will appear. Anchor that layer, by clicking the little anchor symbol.

We want the background to be white, so i put a new white layer under the original image.

c) merge your original image with the layermask down, then invert the image (Colours → Invert).
This image will be our mask.

Set up the tone layers

To set up the layers, copy the final mask-layer image to the clipboard, and create a new (in my case, yellow) layer.
Add a layermask with a right-click and with the layermask selected, paste and anchor the copied mask-image.

In case you dont fully understand layermasks, here is a good short summary i picked up from Glyn Dewis youtubechannel:

"Black conceals and White reveals."

So a layermask acts like a filter, showing all the colour (in this case yellow) where there is white on the layermask, and blocking all the yellow where there is black on the mask. Shades of grey gives you transparent yellow.

4. Duplicate that layer as many times as you want colors, minus two.
Your first, lightest color, doesnt need a layermask and the background needs a different layermask.

5. Add a layermask to the darkest colour layer and copy/paste the mask you used to render your image, but invert it (click on layermask, then 'Colors → Invert').

6. Finally add all the inbetween colours, by drag and dropping them to your layers (or use the Bucket Tool).
Darkest colours on top, lightest to the bottom.

Here are the colours i used:

Threshold the layers

Now its time for the creative fun part.
By manipulating the values of the layermask, we can control what the mask reveals or conceals.

Select the layermask and call up the Threshold Tool.
Move the slider to the right, until you have the amount of shadows you want. In my case im focusing on the eyes.

8. Repeat this for all the other tone-layers, from top to bottom (you can see the values i used in the layernames of the screenshot).

If you are unhappy with a particular layer of your finished result, you can re-paste the original mask and try again.

You can use this method to colorize an image and give it a pop-art effect.

In case you find this confusing or difficult, i uploaded an xcf file with the basic setup (color layers with layermask), you can use to just try out the thresholding step.
The original file is 12,3MB in size so i compressed it. Use a program like 7zip or Winrar to unzip.


If you want to simplifiy and clean up the thresholded mask you can blur it before you apply the thresholding.
In this example i used a value of 3px for the shadows to preserve detail and a value of 8px for the lighter shades.


What you can also do is make two images with the same colours but different levels of simplification and later composite them with a layermask.

For this image i used a version of the posterized image, where every layermask had a Blur of 20px applied before thresholding.

I used the strongly blurred mask version as the base and combined it with the detail of the eyes and lips of this tutorial's image by painting with a brush on the layermask.

open in new tab for bigger version

Using hatchings

Of course you can also use textures instead of colours. For a hatching effect i used a rotated grid.

That concludes this tutorial, hope you like it !


funkpod said...

HELLO! Trying to go step by step and follow this. In step 3, where you ask to "3. To set up the layers, copy the final mask-layer, and create a new layer.
Add a layermask and with the layermask selected, paste and anchor the copied mask-layer."

How is your Marilyn Yellow? Where do I choose that color?

Than kyou!

Espermaschine said...

Hi funkpod !

The steps 1 + 2 are all about PREPARING the image to funciton as a future layermask (remove background, desaturate, invert colors).
In step 3 you create a new layer in any color you want (i chose the yellow).
Then add a layermask to your layer (right click on your layer in the layers-tab and 'Add Layermask').
With this layermask selected, you paste the image you prepared in steps 1+2 (and copied to your clipboard), into the layermask. A floating selection will appear and you need to click the little anchor icon to merge them.

In step 4 you duplicate this layer as many times as you need it, and re-color by dragging and dropping the new color you want. (or use thew bucket fill instead)

Does that help ?

unurban said...

Do you think this could be an improvement?

Espermaschine said...

Well, compare to the work of Shepard Fairey and judge for yourself. I dont think you can automate this effect, it will always require manual work, either with the Bezier Tool or a tablet.

Lazur said...

What a post necromancy... Maybe worth mentioning that all this stuff can be done with a gradient map filter: -if there are still fades at the edges, a colormap filter with indexed colours can help that? (haven't tried the latter).
(Colormap filter can also be generated in inkscape from a set of objects or a gradient by a built-in extension -extensions/modify color/adjust/colormap -set it to discrete mode, and input from group or gradient. When the extension is applied, it will generate a filter. All you need for applying the filter to an object is ticking the filter's checkbox in in the filter editor when an object is selected.)

Espermaschine said...

Gimp's Gradient Map Filter gives me zero control. And i have to set up a custom gradient.

Photoshop's gradient map is live and on-canvas interactive. I guess Inkscape's filters could get near that functionality, but then im still missing a Levels Tool for variation.