mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 05:53:27 -07:00
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:
parent
f19f3d6e63
commit
4a5e04ae23
3 changed files with 276 additions and 390 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue