Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored Nov 5, 2024
1 parent 2f61122 commit a08a113
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ Only png can support semi transparent image and desired color depth. Gif can ens
Let's climb up the mountain: Ready, Go!!!

<p>Original photo of climbing<br /><img src="https://mcychan.github.io/PnnQuant.js/demo/img/climb.jpg" /></p>
<p>Reduced to 256 colors by Divisive hierarchical clustering algorithm<br /><img src="https://i.stack.imgur.com/Qitc4.png" /></p>
<p>Reduced to 256 colors by NeuQuant Neural-Net Quantization Algorithm<br /><img src="https://i.stack.imgur.com/ebUOv.png" /></p>
<p>Reduced to 16 colors by Fast pairwise nearest neighbor based algorithm<br /><img src="https://i.stack.imgur.com/07EFv.png" /></p>
<p>Reduced to 16 colors by Fast pairwise nearest neighbor based algorithm with CIELAB color space<br /><img src="https://i.stack.imgur.com/6GxLY.png" /></p>
<p>Reduced to 16 colors by Xialoin Wu's fast optimal color Quantization Algorithm<br /><img src="https://i.stack.imgur.com/8PEDu.png" /></p>
<p>Reduced to 256 colors by Divisive hierarchical clustering algorithm<br /><img src="https://github.com/user-attachments/assets/31a8c472-16ca-47ea-8f55-8143ad761eab" /></p>
<p>Reduced to 256 colors by NeuQuant Neural-Net Quantization Algorithm<br /><img src="https://github.com/user-attachments/assets/26e00c41-730b-4e23-81f7-a7dec4dc4cf6" /></p>
<p>Reduced to 16 colors by Fast pairwise nearest neighbor based algorithm<br /><img src="https://github.com/user-attachments/assets/f4cadcfc-2770-4cb4-b99e-302c9b5db2ae" /></p>
<p>Reduced to 16 colors by Fast pairwise nearest neighbor based algorithm with CIELAB color space<br /><img src="https://github.com/user-attachments/assets/47daca56-ee8a-49c9-b01b-945de598dfe1" /></p>
<p>Reduced to 16 colors by Xialoin Wu's fast optimal color Quantization Algorithm<br /><img src="https://github.com/user-attachments/assets/f0d26906-4b2b-42de-ae98-f660645cc198" /></p>
<hr />
<p>Original photo of Aetna's Hartford headquarters<br /><img src="https://mcychan.github.io/PnnQuant.js/demo/img/SE5x9.jpg" /></p>
<p>Reduced to 256 colors by NeuQuant Neural-Net Quantization Algorithm<br /><img src="https://i.stack.imgur.com/0sDDn.png" /></p>
<p>Reduced to 256 colors by NeuQuant Neural-Net Quantization Algorithm<br /><img src="https://github.com/user-attachments/assets/b1f4c71b-f33e-40c3-aa20-aa94bf3dec3e" /></p>
<p>Reduced to 256 colors by Fast pairwise nearest neighbor based algorithm<br /><img src="https://repository-images.githubusercontent.com/154477414/29446768-6892-49bc-b949-774c1b3f38de" /></p><hr>

<p>Original image of Hong Kong Cuisines<br /><img src="https://mcychan.github.io/PnnQuant.js/demo/img/old-HK.jpg" /></p>
<b><a href="http://www.cs.joensuu.fi/sipu/pub/Threshold-JEI.pdf">Fast pairwise nearest neighbor based algorithm</a></b> with CIELAB color space in 16 colors<br>
High quality and fast<br />
<img src="https://repository-images.githubusercontent.com/121180544/77908405-ea24-453d-8af9-e255db587c65" alt="Fast pairwise nearest neighbor based algorithm with CIELAB color space with CIELAB color space in 16 colors"></p>
<img src="https://github.com/user-attachments/assets/cf8d36cd-e204-4363-aed1-77f6abe403fa" alt="Fast pairwise nearest neighbor based algorithm with CIELAB color space with CIELAB color space in 16 colors"></p>
<p><b><a href="http://cg.cs.tsinghua.edu.cn/people/~huanghz/publications/TIP-2015-CombinedColorQuantization.pdf">Efficient, Edge-Aware, Combined Color Quantization and Dithering </a></b> with CIELAB color space in 16 colors<br />
Higher quality for 32 or less colors but slower<br />
<img src="https://user-images.githubusercontent.com/26831069/147355642-d72a9e2b-a47a-463a-bfb5-98d1a1def84a.png" alt="Efficient, Edge-Aware, Combined Color Quantization and Dithering with CIELAB color space in 16 colors"></p>
<p><b><a href="https://people.eecs.berkeley.edu/~dcoetzee/downloads/scolorq/">Spatial color quantization</a></b> with CIELAB color space in 16 colors<br />
Higher quality for 32 or less colors but the slowest<br />
<img src="https://i.stack.imgur.com/YB3hZ.png" alt="Spatial color quantization with CIELAB color space in 16 colors"></p>
<img src="https://github.com/user-attachments/assets/b0dbdd2e-4800-42c4-89e3-7f3e03d36d8d" alt="Spatial color quantization with CIELAB color space in 16 colors"></p>
All in all, the top 3 color quantization algorithms for 256 colors are:
<ol>
<li>Fast pairwise nearest neighbor based algorithm</li>
Expand All @@ -42,9 +42,9 @@ The top 3 color quantization algorithms for 32 colors or less are:
<li>Spatial color quantization algorithm with CIELAB color space</li>
</ol>

If you are using the command line. Assuming you are in the same directory as nQuantCpp.exe, you would enter: `nQuantCpp yourImage.jpg /m 16`.<br/>
If you are using the command line. Assuming you are in the same directory as nQuantCpp.exe, you would enter: `nQuantCpp yourImage.jpg /m 16 /a pnnlab`.<br/>
To avoid dot gain, `/d n` can set the dithering to false. However, false contours will be resulted for gradient color zones.<br />
nQuantCpp will quantize yourImage.jpg and create yourImage-PNNLABquant16.png in the same directory.
nQuantCpp will quantize yourImage.jpg with maximum colors 16, algorithm pnnlab and create yourImage-PNNLABquant16.png in the same directory.

The readers can see coding of the error diffusion and dithering are quite similar among the above quantization algorithms.
Each algorithm has its own advantages. I share the source of color quantization to invite further discussion and improvements.
Expand Down

0 comments on commit a08a113

Please sign in to comment.