All Projects β†’ MaxHalford β†’ halfgone

MaxHalford / halfgone

Licence: MIT license
πŸ”³ Black and white digital halftoning

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to halfgone

grayscale
macOS status bar app for easily toggling the grayscale display filter
Stars: ✭ 20 (-53.49%)
Mutual labels:  grayscale
TMS
Tone Mapping Studio
Stars: ✭ 35 (-18.6%)
Mutual labels:  grayscale
ColorVectorSpace.jl
Treat colors as if they are n-vectors for the purposes of arithmetic
Stars: ✭ 28 (-34.88%)
Mutual labels:  grayscale
metal camera
iOS metal camera with GPU shaders.
Stars: ✭ 68 (+58.14%)
Mutual labels:  grayscale
Image-Processing-CLI-in-Rust
CLI for image processing with histograms, binary treshold and other functions
Stars: ✭ 25 (-41.86%)
Mutual labels:  grayscale
Uieffect
UIEffect is an effect component for uGUI element in Unity. Let's decorate your UI with effects!
Stars: ✭ 3,449 (+7920.93%)
Mutual labels:  grayscale

halfgone

This repository contains implementations of digital halftoning - also called dithering - algorithms written in Go. The implementations are restricted to black and white rendering and are based on the image library from Go's standard library.

The implementations are quite fast but are not optimized for production where you would typically want to use bit shifting when possible. I moved the common code for error-diffusion dithering into a separate functions because it's always the same underlying algorithm, whether it be Floyd-Steinberg dithering or Stucki dithering. I did the same for ordered dithering. In production you would probably want to choose a particular dithering algorithm and avoid using generic code which makes it harder to write optimized code.

If you are interested in digital halftoning, this web page is, in my opinion, a fantastic introduction. I've also written a blog post which goes through some of the implementations.

Original image

img := LoadImage("images/penguin.jpg")

original

Grayscale

gray := ImageToGray(img)

grayscale

Inverted grayscale

InvertGray(gray)

reversed_grayscale

Threshold dithering

halfgone.ThresholdDitherer{Threshold: 127}.Apply(gray)

threshold_dithering

Random threshold dithering

halfgone.RandomThresholdDitherer{MaxThreshold: 255, RNG: rng}.Apply(gray)

random_threshold_dithering

Importance sampling

halfgone.ImportanceSampling{N: 4000, Threshold: 100, RNG: rng}.Apply(gray)

importance_sampling

Bosch and Herman’s grid-based dithering

halfgone.GridDitherer{K: 5, Alpha: 3, Beta: 8, RNG: rng}.Apply(gray)

grid_dithering

Ordered dithering

Order-2 ordered dithering

halfgone.Order2OrderedDitherer{}.Apply(gray)

order_2_ordered_dithering

Order-3 ordered dithering

halfgone.Order3OrderedDitherer{}.Apply(gray)

order_3_ordered_dithering

Order-4 ordered dithering

halfgone.Order4OrderedDitherer{}.Apply(gray)

order_4_ordered_dithering

Order-8 ordered dithering

halfgone.Order8OrderedDitherer{}.Apply(gray)

order_8_ordered_dithering

Error-diffusion dithering

Floyd-Steinberg dithering

halfgone.FloydSteinbergDitherer{}.apply(gray)

floyd_steinberg_dithering

Jarvis-Judice-Ninke dithering

halfgone.JarvisJudiceNinkeDitherer{}.Apply(gray)

jarvis_judice_ninke_dithering

Stucki dithering

halfgone.StuckiDitherer{}.Apply(gray)

stucki_dithering

Atkinson dithering

halfgone.AtkinsonDitherer{}.Apply(gray)

atkinson_dithering

Burkes dithering

halfgone.BurkesDitherer{}.Apply(gray)

burkes_dithering

Sierra dithering

halfgone.SierraDitherer{}.Apply(gray)

seria_dithering

Two-row Sierra dithering

halfgone.TwoRowSierraDitherer{}.Apply(gray)

two_row_seria_dithering

Sierra Lite dithering

halfgone.SierraLiteDitherer{}.Apply(gray)

seria_lite_dithering

License

The MIT License (MIT). Please see the license file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].