Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managed PNG Optimization Library Available? [closed]

Tags:

c#

.net

png

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?

like image 347
Issa Fram Avatar asked Sep 09 '11 14:09

Issa Fram


1 Answers

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.

like image 75
Igor Brejc Avatar answered Oct 21 '22 05:10

Igor Brejc