All Projects β†’ dbohdan β†’ hicolor

dbohdan / hicolor

Licence: MIT license
🎨 Convert images to 15/16-bit RGB color with dithering

Programming Languages

c
50402 projects - #5 most used programming language
tcl
693 projects
Makefile
30231 projects

Projects that are alternatives of or similar to hicolor

nQuantCpp
nQuantCpp includes top 6 color quantization algorithms for visual c++ producing high quality optimized images.
Stars: ✭ 83 (-51.74%)
Mutual labels:  dithering, color-quantization
colorquant
Go library for color quantization and dithering
Stars: ✭ 75 (-56.4%)
Mutual labels:  dithering, color-quantization
pigmnts
🎨 Color palette generator from an image using WebAssesmbly and Rust
Stars: ✭ 38 (-77.91%)
Mutual labels:  color-quantization
KGySoft.Drawing
KGy SOFT Drawing is a library for advanced image, icon and graphics handling.
Stars: ✭ 27 (-84.3%)
Mutual labels:  dithering
Deep-Learning
This repo provides projects on deep-learning mainly using Tensorflow 2.0
Stars: ✭ 22 (-87.21%)
Mutual labels:  color-quantization
k-means-quantization-js
🎨 Apply color quantization to images using k-means clustering.
Stars: ✭ 27 (-84.3%)
Mutual labels:  color-quantization
DitherPunk.jl
Dithering algorithms in Julia.
Stars: ✭ 28 (-83.72%)
Mutual labels:  dithering
create-optimize-images
♻️ Reusable, scalable, bash scripts to create and optimize images.
Stars: ✭ 39 (-77.33%)
Mutual labels:  image-conversion
WernessDithering
Copy of dithering code by Brent Werness (Koloth) invented for Obra Dinn
Stars: ✭ 24 (-86.05%)
Mutual labels:  dithering
undither
Smart filter to remove Floyd-Steinberg dithering from paletted images
Stars: ✭ 38 (-77.91%)
Mutual labels:  dithering
bmp2tile
Converts images to Master System data formats
Stars: ✭ 30 (-82.56%)
Mutual labels:  image-conversion
TinyVG
A new format for vector graphics: Tiny vector graphics
Stars: ✭ 35 (-79.65%)
Mutual labels:  image-format
sail
The missing small and fast image decoding library for humans (not for machines) β›΅ https://sail.software
Stars: ✭ 206 (+19.77%)
Mutual labels:  image-library
canvas-dither
πŸ–Ό Simple demo of image processing in Javascript using HTML5 and Canvas
Stars: ✭ 40 (-76.74%)
Mutual labels:  dithering
MultiTileBlueNoise
Storage for blue noise textures, including mixed-tiling textures, in results/
Stars: ✭ 16 (-90.7%)
Mutual labels:  dithering
png2svg
πŸ”€ Convert small PNG images to SVG Tiny 1.2
Stars: ✭ 219 (+27.33%)
Mutual labels:  image-conversion
Image-to-Braille
Give it an image, and it will become unicode braille
Stars: ✭ 140 (-18.6%)
Mutual labels:  dithering
node-flif
A Node wrapper for the FLIF executable
Stars: ✭ 43 (-75%)
Mutual labels:  image-conversion

HiColor

A building with a dithered gradient of the sky behind it.  A jet airplane is taking off in the sky.

HiColor is a program for converting images to 15- and 16-bit RGB color, the color depth of old display modes known as β€œhigh color”. In 15-bit mode images have 5 bits for each of red, green, and blue, and the last bit is reserved. In 16-bit mode green, the color the human eye is generally most sensitive to, gets 6 bits.

I wrote this program because I wanted to create images with the characteristic high-color look, and nothing seemed to support high color. It implements its own simple file format and converts between this format and PNG. It can also convert normal PNG to normal 32-bit PNG with only high color color values. (This simulates a roundtrip through HiColor without creating a temporary file.) To reduce the quantization error (the difference between the original and the high-color pixel), HiColor uses the Bayer ordered dithering algorithm, which historical software and hardware used for dithering in high color modes. Dithering can be disabled with a command line flag. HiColor files have the extension .hic or .hi5 for 15-bit and .hi6 for 16-bit.

Quantized images compress better when their originals, so HiColor may serve as a less-lossy alternative to the 256-color pngquant. Quantizing a PNG file to PNG preserves transparency (but does not quantize the alpha channel). Conversion to and from the HiColor format does not preserve transparency.

The program is written in C with minimal dependencies and builds as a static binary by default. It works at least on Linux and Windows 98 Second Edition, 2000 Service Pack 4, XP, and 7.

Known bugs and limitations

PNG file size

PNG files HiColor produces are unoptimized. Run them through OptiPNG.

Generation loss

Right now repeated conversion to .hic and repeated quantization cause (capped) generation loss when dithering is enabled (by default). There is no such generation loss without the dithering. I am not sure whether to fix this or to keep it for artistic use. I think the effect looks cool on colorful high-contrast anime-style images, making them resemble PC-98 art. The example below illustrates a best-case scenario. It converged (stopped changing) after 50 generations. Most anime images won't look this good.

An example of color generation loss with HiColor

(Cropped from a piece by Suparu. I believe this is fair use, but I'll remove this picture if you own it and ask.)

A photo of New York City after 100 generations of quantize..

Photos suffer more than artwork. They work best when they are high-contrast with a lot of neon.

Usage

HiColor has a Git-style CLI.

The actions encode and decode convert images between PNG and HiColor's own image format. quantize round-trips an image through the converter and outputs a normal PNG. Use it to create images that look high-color but aren't. info displays information about a HiColor file: version (5 for 15-bit or 6 for 16), width, and height.

HiColor
Create 15/16-bit color RGB images.

usage:
  hicolor (encode|decode|quantize) [options] src [dest]
  hicolor info file
  hicolor version
  hicolor help

options:
  -5, --15-bit     15-bit color
  -6, --16-bit     16-bit color
  -n, --no-dither  Do not dither the image

Building

Debian/Ubuntu

sudo apt install -y build-essential graphicsmagick tclsh
make test

Cross-compiling for Windows

The following commands build a 32-bit executable for Windows.

sudo apt install -y build-essential gcc-mingw-w64-i686
make hicolor.exe
# Wine, Tcl, and GraphicsMagick are needed only for testing.
sudo apt install -y graphicsmagick tclsh wine
make test-wine

License

MIT.

cute_png is copyright (c) 2019 Randy Gaul and is licensed under the zlib license.

Photos from Unsplash

Building photo with a plane from Bordeaux (bordeaux-15bit.png) by olaf wisser.

NYC photo (nyc-15bit-gen-100.png) by Phi Tran.

Portland photo (tests/photo.png) by Orlova Maria.

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].