Now Reading
Lid: Lo-fi Picture Dithering

Lid: Lo-fi Picture Dithering

2023-01-12 13:11:17

Basic Data

Lid is a picture dithering program that’s written in Python.


Lid was inpired by the photo voltaic powered model of [Lowtech Magazine]. I actually liked their easy strategy to pictures. They maintain the filesize down utilizing single coloration dithered photographs after which apply coloration filters to brighten up the web page. That passes on the colour work to the shopper somewhat than being part of the net request (extra knowledge being despatched).

One other inspiration was [Shizaru], an online server, by the founding father of [Circumlunar Space], that locations limits on the content material that it’ll serve. The purpose being to cut back internet bloat and concentrate on content material. A kind of restrictions is on picture measurement; 32k is the max! Lid was written to supply a straightforward method to get even giant photographs right down to a measurement that may be displayed by Shizaru.

Fast Begin

As soon as Lid is put in on a system, run lid adopted by a filepath after which the title you wish to use for the output file.

There are a variety of choices/flags a consumer can set to get completely different output. The commonest being -m which modifications the dithering mode. The default dither produces an approximation of a 4 coloration pallet; this produces a really small file… however shouldn’t be the most effective to have a look at. Utilizing one of many different modes will produce a barely bigger file, however often prettier output. Please learn the [documentation] part to search out out extra.



Lid is run from the command line as follows: lid [flags]… [source path] [output name]. Flags are completely non-obligatory and exist to high-quality tune the output.

By default lid can soak up most picture codecs, however will output a png file. That is the really useful filetype for lid to output. It has the most effective stability of high quality and filesize. Nonetheless, lid does additionally assist outputting jpg and gif as nicely.

At current lid presents six completely different dithering modes:

  1. t threshold dithering (aka common dithering)
  2. r radom dithering
  3. o4 ordered dithering w/ 4 ranges (default)
  4. o9 ordered dithering w/ 9 ranges
  5. e error diffusion dithering
  6. a all (converts enter to each different mode supplied)

The upper the quantity (above) the higher the standard however the larger the filesize. That stated, when outputting to png all needs to be a very good quantity smaller than the supply file. The exception to the upper quantity larger high quality larger filesize assertion is random dithering. Random dithering is an fascinating impact, however its high quality shouldn’t be so photographic and it has practically the identical measurement as error diffusion, which is rather more photographic.

The house financial savings of photographs produced through lid is often lower than half the dimensions of the unique, although that may differ from picture to picture. Nonetheless, the concept behind lid is extra in regards to the aesthetics of an older manner of doing issues mixed with decreased bloat. A picture produced by lid is most positively not going to equal to the image high quality of a full coloration digital {photograph}, that isn’t the intention. The hope is for individuals to see that you are able to do plenty of cool and artistic stuff with small photographs, algorithms, and old-web allure.


Lid accepts a number of flags allways given on the command line because the flag adopted by an area adopted by the worth.

— Flags —
-f jpg, jpeg, gif, png (default) Modifications the output format
-m o4 (default), o9, e, t, r, a Modifications the dithering mode
-q Integer from 1 – 100 Set output high quality (just for jpg output)
-t Integer from 0 – 255 Set the edge (just for threshold mode, defaults to picture common degree)


lid -f jpg -m t -t 100 ~/Dekstop/myImage.png myDitheredImage

lid -m o9 ~/Desktop/myImage.png o9DitheredImage

Within the above, the primary line will create a jpg file named myDitheredImage.jpg. That picture will probably be created utilizing a threshold dither with the edge set at 100.

The second instance will use an o9 dither and export to the default file format (png) as o9DitheredImage.png.

Getting Lid

Lid is written within the programming language [Python]. Since Python is a scripting language it doesn’t compile to binary recordsdata. As such, customers might want to have Python working on their system. Lid requires a Python model >= 3.0. Many techniques include Python already put in, make sure you confirm the model by working: ‘python –version. Moreover, many techniques have each Python 2.7 and Python 3+ put in. Generally Python 3 is aliased to ‘python3‘.

See Also

Lid requires the Python library Pillow (a Python think about library fork). To accumulate Pillow a consumer can strive working: pip3 set up Pillow (it’s potential that your set up could also be aliased to simply pip

That ought to deal with dependencies. You simply have to guarantee that lid, present in [this repo], is executable and in your path and you’re good to go.

Picture Examples

Under you’ll find photographs produced with lid, plus the unique picture, after which a model of the o9 picture utilizing css to attain an instance coloration impact. The colour impact provides no measurement to the picture and is finished by the browser (assuming your browser helps css and pictures).

Ripley in her space suit, from the film Alien; threshold dither
t – threshold dithering – 15k

Ripley in her space suit, from the film Alien; 4 level ordered dither
o4 – ordered dithering w/ 4 ranges – 20k

Ripley in her space suit, from the film Alien; 9 level ordered dither
o9 – ordered dithering w/ 9 ranges – 42k

Ripley in her space suit, from the film Alien; random dither
r – random dithering – 64k

Ripley in her space suit, from the film Alien; error diffusion dither
e – error diffusion – 68k

Ripley in her space suit, from the film Alien; original full color, no dither
unique picture – 140k

CSS styled picture utilizing o9 dithering – nonetheless 42k

Source Link

What's Your Reaction?
In Love
Not Sure
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top