https://github.com/dbohdan/hicolor Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} dbohdan / hicolor * Notifications * Star 102 * Fork 2 Convert images to 15/16-bit RGB color with dithering MIT License 102 stars 2 forks Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 4 tags Code Clone HTTPS GitHub CLI [https://github.com/d] Use Git or checkout with SVN using the web URL. [gh repo clone dbohda] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @dbohdan dbohdan docs(readme): label gen in anime gen loss example ... f00eac4 Jul 11, 2021 docs(readme): label gen in anime gen loss example f00eac4 Git stats * 42 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows ci(github): add .github/workflows/ci.yml Jul 4, 2021 tests feat(cli): understand any prefix of action Jul 8, 2021 vendor build(cute_png): add vendor/cute_png.h Jul 4, 2021 .gitignore build(gitignore): add .gitignore Jul 4, 2021 AUTHORS docs(license): add AUTHORS and LICENSE Jul 4, 2021 LICENSE docs(license): add AUTHORS and LICENSE Jul 4, 2021 Makefile build(makefile/install): fix hicolor.h install Jul 8, 2021 README.md docs(readme): label gen in anime gen loss example Jul 11, 2021 bordeaux-15bit.png docs(readme): improve style; add more on PNG2PNG Jul 5, 2021 cli.c docs(cli): add top comment Jul 10, 2021 format.md docs(format): replace "foo" with foo Jul 5, 2021 hicolor.h docs(lib): add top comment Jul 10, 2021 nyc-15bit-gen-100.png docs(readme): add README.md and images for it Jul 5, 2021 View code HiColor Known bugs and limitations PNG file size Generation loss Usage Building Debian/Ubuntu Cross-compiling for Windows License Photos from Unsplash README.md 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. About Convert images to 15/16-bit RGB color with dithering Topics image-processing dithering image-conversion color-quantization image-format image-library color-reduction high-color Resources Readme License MIT License Releases 4 v0.2.1 Latest Jul 8, 2021 + 3 releases Languages * C 79.5% * Tcl 17.2% * Makefile 3.3% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.