Replaces .NET's disgusting default GIF encoding algorithm with Octree quantization and dithering, and allows 8-bit PNG creation. Compatible with all plugins.
Install-Package ImageResizer.Plugins.PrettyGifs in the NuGet package manager, or:
- Add ImageResizer.Plugins.PrettyGifs to your project
<add name="PrettyGifs" />inside
Supported querystring commands
- preservePalette=true|false - If true, will attempt to use the original palette if present instead of recalculating it.
Why not nQuant?
A) On an informal test, it was 10x slower than the Octree algorithm on a 256x256 PNG. I.e, 1900ms vs 195ms. It also took 80MB of ram, while Octree took kilobytes. B) It intrinsically requires 50MB ((324)x(6x8)=50,331,648 bytes) of ram per encode just to store the histogram information for any size file. This is an intrinsic limitation of any implementation of Xiaolin Wu's color quantizer. Versus kilobytes for the Octree algorithm. C) Only works for PNG files, it's designed for a multi-bit alpha channel. I could fix that, though. D) The nQuant implementation also makes excessive copies of the image, making it scale poorly. For example, on a 1300x840 PNG, nuQuant took 18.8 seconds and 110-130MB of ram, while Octree took 0.3 seconds and 4-8MB of RAM. This is also fixable, I believe.