1
1
Fork
You've already forked Laime
0
Simple ditherer written in C
  • C 99.7%
  • Shell 0.3%
Find a file
Reiddragon ac887f262f Updated the README
Specified the output is always in PNG, and added a mention and
explanation of the `-no-dithering` flag.
2025年07月03日 16:52:31 +03:00
src Added a no dithering mode 2025年07月03日 16:50:15 +03:00
build.sh initial commit 2025年07月02日 14:51:53 +03:00
LICENSE.md Added a LICENSE.md 2025年07月02日 14:55:31 +03:00
README.md Updated the README 2025年07月03日 16:52:31 +03:00

Laime

A simple ditherer written in C, using stb.

What can it do?

Laime currently supports the following dithering algorithms:

  • Atkinson
  • Ordered with an 8x8 Bayer matrix
  • Floyd-Steinberg

Building

In order to build Laime, you will need a C compiler, and the stb_image.h, stb_image_write.h, and stb_image_resize2.h single header libraries from stb.

On Arch Linux, the entire set of stb libraries is packaged as stb.

# pacman -S stb

Finally, to build Laime, simply run ./build.sh which will call your default C compiler (cc in $PATH).

$ ./build.sh

Usage

Here be dragons

Basic usage:

$ laime --input <path/to/image> --output <path/to/image.png> [OPTIONS]... [--<ditherer>]

Required flags:

  • --input <path/to/image>
    • Specifies the input file.
    • Supported formats: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC.
  • --output <path/to/image.png>
    • specifies the output file
    • the output is always PNG

Optional flags:

  • --shades <2-256>
    • Specifies the number of values allowed for each channel between and including 0 and 255
  • --channels <0-4>
    • specifies the colour format of the output image as a number of channels
      • 0 - keep the format of the original image
      • 1 - grayscale
      • 2 - grayscale + alpha
      • 3 - RGB
      • 4 - RGBA
  • --downsize <factor>
    • specifies a factor by which to downscale the image before dithering
    • the image gets upscaled back by the same factor after dithering
    • this may be desirable to accentuate the dither pattern for some algorithms

Note: when any of the above flags is declared multiple times, only the last instance of each takes effect.

The ditherer may also be specified using one of the following flags:

  • --atkinson
  • --bayer
  • --floyd-steinberg (default if none is specified)

In addition to the above ditherers, you may also choose to use the --no-ditherer flag to only limit the colour space without dithering the image.

Note: if multiple flags to choose a ditherer are used, only the last one to be specified takes effect.