-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #371 from tannerhelland/neuquant
This merge adds a new neural-network color quantizer to PhotoDemon. (A color quantizer builds a palette of [n] colors from an existing image.) I started with [Neuquant](https://en.wikipedia.org/wiki/Color_quantization#Algorithms), a well-known color quantizer, and reworked the algorithm extensively to better fit PD's unique use-cases and performance requirements. This included overhauling the algorithm to also work with alpha channels. The end result is a fast, powerful quantizer than can produce remarkably high-quality 8-bit (<=256 color) images, which is particularly relevant for things like exporting animated GIFs. I'm currently investigating adding animated WebP support to the project, which is part of what prompted this work on a new, better quantizer. One of the unique strengths of Neuquant is how well it can produce palettes for images with subtle gradients, like logos, charts, or 3D-rendered objects/scenes. This makes it especially useful for optimizing images for the web, because Neuquant can produce 8-bit versions of images that look very close to their 32-bit counterparts, but unlike other mechanisms that rely on dithering to "artificially" make color density look richer, Neuquant simply generates a much better palette. This lets you get away with undithered 8-bit reduction for most images, which greatly improves compressibility of the final image (compared to the "noise" dithering naturally introduces). Anyway, the main use-cases of this new feature are hidden, with PD silently leaning on the new color quantizer when relevant (like saving to 8-bit formats a la GIF). To play with the quantizer as a standalone feature, you can use the Effects > Stylize > Palettize tool, which directly exposes the quantizer for experimentation.
- Loading branch information
Showing
30 changed files
with
1,127 additions
and
646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.