Skip to content

kakol20/OkLab-Dithering

Repository files navigation

OkLab Dithering

OkLab Dithering

JSON

Comments in settings.json not supported

Settings

{
	"ditherType": "ordered",
	"distanceMode": "srgb",
	"mathMode": "lrgb",
	"hideSemiTransparent": false,
	"hideThreshold": 127,
	"mono": false,
	"grayscale": false,
	"matrixType": "bluenoise128",
	"ditherAlpha": true,
	"ditherAlphaFactor": 1,
	"ditherAlphaType": "ordered",
	"shape": {
		"size": [ 3, 2 ],
		"points": [
			[ 0, 0 ],
			[ 2, 0 ],
			[ 0, 1 ],
			[ 1, 1 ],
			[ 2, 1 ],
			[ 1, 2 ]
		]
	}
}
All string settings are case insensitive

ditherType

  • ordered for ordered dithering
    • With new ordered dithering method mathMode is not used
  • floyd or floyd-steinberg or steinberg or fs for Floyd-Steinberg dithering
  • none for no dithering

distanceMode and mathMode

  • srgb for sRGB
  • oklab for all values
  • oklab_l for lightness only
  • lrgb for Linear RGB

hideSemiTransparent

  • true or false

hideThreshold

  • An unsigned integer between 0 and 255

mono

  • true or false
    • Treats selected palette like it's a monochromatic palette
    • Will override grayscale setting
    • NOTE: Due to the math - math mode oklab and oklab_l will produce the same result

grayscale

  • true or false
    • Uses distanceMode to determine conversion to grayscale
    • NOTE: Due to the math, math mode oklab and oklab_l will produce the same result

matrixType

Matrix used for ordered dithering

  • bayerN
    • Where N is the size of the bayer matrix
    • N must be a power of two
    • Be careful of high values of N
  • blueNoiseN
    • Where N is the size of the blue noise matrix
  • ign Interleaved Gradient Noise
  • parkerDither based on Matt Parker Parker Square
  • heart a custom threshold map in the shape of pixel hearts
  • circle a custom threshold map in the style of half-tone
  • bayerShapeN
    • Where N is the size of the bayer matrix
    • N must be a power of two
    • Uses shape setting - more

ditherAlpha

  • true or false
    • Enables dithering of alpha channel
    • This setting is overridden if hideSemiTransparent is true

ditherAlphaFactor

  • An unsigned integer between 0 and 255
    • Factor for alpha dithering

ditherAlphaType

  • Same options as ditherType
    • Dithering algorithm for alpha channel
    • Uses matrixType for the threshold matrix

shape

  • Object type
    • size - The size of a cell in the form of a 1D Array - [width, height]
      • Will result in a threshold map size of (N * width, N * height)
    • points - A 2D array of points to apply the threshold value relative to the origin (0, 0)
      • In the form of [[x, y]...]
      • Points can extend beyond the cell's size
      • Any point extending beyond the map's full size will be wrapped

Credits

JSON for Modern C++ version 3.12.0
stb_image

About

Dithering

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors