/Lamp-Display-Emulator

Minecraft Redstone Lamp Display Emulator

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

Minecraft Redstone Lamp Display Emulator

Website for converting images to Minecraft redstone lamps (1 bit). Upload an image and choose binarization and dithering algorithm to turn it into the lamps.

image Screenshot from the game “Return of the Obra Dinn” by Lucas Pope processed by this tool

Algorithms

So far I've implemented those local binarization algorithms:

and those ordered dithering algorithms:

and those error diffusion dithering algorithms:

  • Floyd-Steinber
  • Jarvis-Judice-Ninke
  • Atkinson
  • Stucki
  • Burkes
  • Sierra
  • Two-Row Sierra
  • Sierra Lite
  • Stevenson-Arce

How it works

If you wish to know how exactly dithering and binarization works I provided a lot of useful resources later in this article. What I haven't seen anyone else do is combine binarization and dithering. Let me explain on this random image from the internet:
d347c39f-10c3-4471-98b2-8ec258dd6faa
input image

The main goal of dithering is to preserve monochrome colour:
image
dithered with R2 algorithm threshold=128

But this comes with the loss of detail, for example text is not readable now. The main goal of binarization is to preserve detail, is it mainly used in OCR:
image
binarized with Sauvola method m=7, k=0.25

As you can see now we lost all the colour. So my method is to process original image with binarization and dithering algorithms separately and later combine by multiplying corresponding pixels together. This way we preserve both colour and detail information:
image
both algorithms combined

Examples

Here are some examples of it working, for input I took pixelarts from sexypixelize and processed them:

image
Dithering algorithm: Jarvis-Judice

image
Global binarization: threshold

image
Dithering algorithm: Floyd-Steinberg

image
Dithering algorithm: Bayer 8x8

image
Dithering algorithm: Jarvis-Judice

image
Dithering algorithm: Jarvis-Judice

Useful resources if you want to dive deeper into 1 bit image processing

Atricles:
Ditherpunk — The article I wish I had about monochrome image dithering
Image Dithering: Eleven Algorithms and Source Code
Image segmentation (ru)

Tools:
dithering demo
binarization demo
dithering

How to launch yourself using Node.js and Visual Studio Code

# install yarn
npm install --global yarn

# now install all modules
yarn

# now start project
yarn dev

# build ssg version
yarn generate

License

This program is licensed under the GPL-3.0 License. Please read the License file to know about the usage terms and conditions.