I am looking to build in PNG optimization (a PNG "sqeezer/squisher" of sorts) into my builds (TFS 2010 Build Workflow). I want to create a new build activity and as with all my activities, I prefer to have all my code managed with little to no dependencies.
I have searched (Googled) and found many different PNG libraries for PNG optimiaztion. PNGOUT, PNGCRUSH, OptiPNG, etc. None of them are really .NET. They all seem like great tools. I prefer not to call EXE files (separate processes) from my code activity because you never really know what will happen (less reliable).
So i thought maybe PNGGauntlet would be an option. But looking quickly at the installed application, its merely an C# GUI that calls the binary pngout.exe. That is exactly what I don't want to do.
So my question is this : Is there an open-source and/or free .NET library (DLL) that does PNG compression?
I've just found this one: nQuant. From the project page:
nQuant is a .net color quantizer that produces high quality 256 color 8 bit PNG images. nQuant often reduces the size of a 32 bit image to a size 3 times smaller than its original with quality surpassing what the standard C command line utilities produce.
I've tested it out with some sample PNGs and it really does produce a good 8-bit output, smaller than .NET's own 8-bit encoder and with no visible dithering, even for antialiased images. I miss one thing, however: the processing can be a bit slow, but the library unfortunately doesn't have a parallelized variant of the optimization code. I'm working on a solution for this.
UPDATE (Jan 21, 2013), I've refactored the code, it runs 10 times faster now, even without the parallel threads. The fork is here: http://nquant.codeplex.com/SourceControl/network/forks/breki74/nQuantFaster
UPDATE (Feb 24, 2013), my fork was merged to the trunk. Enjoy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With