Added auto reduction test as a property, so we can turn it off if the results are contra productive. Updated the readme.txt

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1714 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-03-20 17:04:41 +00:00
commit d3246b4368
3 changed files with 20 additions and 14 deletions

View file

@ -100,19 +100,23 @@ namespace Greenshot.Helpers {
break;
}
// If Quantizing is enable, overwrite the image to save with a 256 - color version
IColorQuantizer quantizer = ImageHelper.PrepareQuantize((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);
// Make sure the "new" image is disposed
disposeImage = true;
} catch(Exception e) {
LOG.Warn("Error occurred while Quantizing the image, ignoring and using original. Error: ", e);
// check for color reduction, forced or automatically
if (conf.OutputFileAutoReduceColors || reduceColors) {
IColorQuantizer quantizer = ImageHelper.PrepareQuantize((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);
// Make sure the "new" image is disposed
disposeImage = true;
} catch (Exception e) {
LOG.Warn("Error occurred while Quantizing the image, ignoring and using original. Error: ", e);
}
}
} else {
LOG.Info("Skipping color reduction test, OutputFileAutoReduceColors is set to false.");
}
try {

View file

@ -3,7 +3,7 @@ Greenshot: A screenshot tool optimized for productivity. Save a screenshot or a
CHANGE LOG:
0.9.0 Build 1667
0.9.0 Build 1714
We changed the version to 0.9.0 as the amount of features in 0.8.1 was more than planned.
@ -25,7 +25,7 @@ Features added:
* Added Ctrl/shift logic to the editor, hard to explain (see help) but hold one of the keys down and draw..
* Added a color picker in the color dialog.
* Added shadow & torn edges
* Added color reduction as an option and auto detection for image with less than 256 color. When using reduction this results in smaller files.
0.8.1 Build 1483

View file

@ -92,6 +92,8 @@ namespace GreenshotPlugin.Core {
public OutputFormat OutputFileFormat = OutputFormat.png;
[IniProperty("OutputFileReduceColors", Description="If set to true, than the colors of the output file are reduced to 256 (8-bit) colors", DefaultValue="false")]
public bool OutputFileReduceColors;
[IniProperty("OutputFileAutoReduceColors", Description = "If set to true the amount of colors is counted and if smaller than 256 the color reduction is automatically used.", DefaultValue = "true")]
public bool OutputFileAutoReduceColors;
[IniProperty("OutlookEmailFormat", Description = "Default type for emails. (Text, HTML)", DefaultValue="HTML")]
public EmailFormat OutlookEmailFormat;