This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Pixel art ordered dithering in Krita, anyone know how?

Tags: None
(comma "," separated)
heiza
Registered Member
Posts
1
Karma
0
I was wondering how to intentionally limit my colour palette in Krita so I can draw pixel art like they did in the 90's, and when I need to create more colours (or the illusion of them) that's where ordered dithering comes in

Like this:

Image

And like the left hand example, when Windows 95 was limited to 16 colours but more were created with ordered dithering:

Image

The "Common Workflows" tutorial wasn't helpful and was pretty vague.
ahabgreybeard
Registered Member
Posts
1269
Karma
11
OS
If you want to limit your colour palette then you can use one of the standard colour palettes such as PixelArt 16 or PixelArt 32, available in the Palettes docker. You can make your own custom palette if you really want to or download them from somewhere.

If you have too many colours to start with then Filter -> Artistic -> Posterise may be of use to you.
ro
Registered Member
Posts
4
Karma
0
If you want only one dither pattern:
New Filter Mask -> Map -> Palettize -> Dither

However, the example you show has many patterns, namely every second of the following ones:
Image

To achieve something like that, possible solutions are:

1. We should make a feature request for dithering with several patterns.

2. Write a Krita script or plugin that calls an external program that performs dithering. Here's a draft that works okay, you should install ImageMagick (you can play with its settings in the code below), rename a layer to "fordither" and create the directory "C:\tmp\" and then run the following script in the Krita Scripter:
Code: Select all
from krita import *
import subprocess
import os

ki = Krita.instance()
doc = ki.activeDocument()

filename_fordither = 'C:\\tmp\\fordither.png'
filename_dithered = 'C:\\tmp\\dithered.png'

LAYERNAME_FORDITHER = "fordither"
node = doc.nodeByName(LAYERNAME_FORDITHER)

if node is None:
    print('Please rename a layer to "'+LAYERNAME_FORDITHER+'".')

else:
    # save image to file
    exportConfiguration = InfoObject() # no arguments means default
    #doc.exportImage(filename_fordither, exportConfiguration)
    node.save(filename_fordither, 1, 1, exportConfiguration)

    # apply ImageMagick dithering
    #subprocess.run("")
    os.system("magick convert "+filename_fordither+" -ordered-dither o8x8,6 "+filename_dithered)

    # create File Layer from dithered file
    LAYERNAME_DITHERED = "dithered"
    if doc.nodeByName(LAYERNAME_DITHERED) is None:
        newnode = doc.createFileLayer(LAYERNAME_DITHERED, filename_dithered, "ImageToSize")
        #node = doc.rootNode()
        node.addChildNode(newnode, None)

    doc.refreshProjection()


3. Dithering on the fly upon each change of the undithered image as follows:


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]