Performance improvements for the Wu quantizer.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1717 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-03-21 11:44:13 +00:00
commit 4a5e04ae23
3 changed files with 276 additions and 390 deletions

View file

@ -107,13 +107,13 @@ namespace Greenshot.Helpers {
// check for color reduction, forced or automatically
if (conf.OutputFileAutoReduceColors || reduceColors) {
IColorQuantizer quantizer = ImageHelper.PrepareQuantize((Bitmap)imageToSave);
WuQuantizer quantizer = new WuQuantizer((Bitmap)imageToSave);
int colorCount = quantizer.GetColorCount();
LOG.InfoFormat("Image with format {0} has {1} colors", imageToSave.PixelFormat, colorCount);
if (reduceColors || colorCount < 256) {
try {
LOG.Info("Reducing colors on bitmap to 255.");
imageToSave = ImageHelper.Quantize((Bitmap)imageToSave, quantizer, 255);
imageToSave = quantizer.GetQuantizedImage(255);
// Make sure the "new" image is disposed
disposeImage = true;
} catch (Exception e) {