Quantize a PNG with TBgrabmp: How to do it? lazarus / 39-Graphics ---------------------------------------------------------------------- Boleeman · 2024-12-31 04:39 Wondered if anyone has some sample code to quantize a png picture file with TBgrabmp ? In my search I came across these (but was still looking for a TBgraBmp alternative): PngDrop:     GUI tool for creating PNG8 (Done in Lazarus) https://github.com/c-yan/pngdrop I quickly played around with PNGDrop) ( written in Lazarus by a cluey Japanese guy c-yan  , Sunday programmer in Tokyo, Japan ) Here are my findings: It contains some great ColorReduction pascal code that uses TLazIntfImage Looks like it uses IntegerTripleArrays, KMeans, AverageError and Map Color with Dithering. Uses drag and drop to load the png image and even saves it back to the original folder. I tried it on a 233kB png and it compressed it to only 79kB. Amazing. Also tried a 306kB transparent png and it compressed it to only 79kB. (attached is the sample png that was compressed,) ---------------------------------------------------------------------- circular · 2024-12-31 15:59 Sure, here is an example to reduce to 256 colors: https://forum.lazarus.freepascal.org/index.php?topic=61252.0 ---------------------------------------------------------------------- Boleeman · 2025-01-01 01:07 Thank you circular and Happy New Year to you. ---------------------------------------------------------------------- circular · 2025-01-14 16:54 You're welcome. Happy new year