Skip to content

Instantly share code, notes, and snippets.

@jurca
jurca / low-fi-image.js
Created Apr 30, 2021
Low-bit-depth image convertor
View low-fi-image.js
/*
* Usage example:
* img = document.querySelector('img')
*
* document.body.append(createLoFiImage(i, [5, 6, 5])) // High color 15-bit
* document.body.append(createLoFiImage(i, [4, 4, 4])) // 12-bit
* document.body.append(createLoFiImage(i, [3, 3, 2])) // // 8-bit "truecolor" - 3 red bits, 3 green bits, 2 blue bits
*/
function createLoFiImage(sourceImage, bitDepths) {
View css properties order
// zobrazení
display
// pozicování
float
position
left
right
top
bottom