mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Activated Quantizing code, still needs a GUI for it...
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1706 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
45b8d112df
commit
0722cbfe22
2 changed files with 18 additions and 18 deletions
|
@ -358,7 +358,6 @@
|
|||
<Folder Include="Controls" />
|
||||
<Folder Include="Helpers\IEInterop" />
|
||||
<Folder Include="Memento" />
|
||||
<Folder Include="Helpers\OfficeInterop" />
|
||||
<Folder Include="Lib" />
|
||||
<Folder Include="Languages" />
|
||||
<Folder Include="Help" />
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace Greenshot.Helpers {
|
|||
/// </summary>
|
||||
public static void SaveToStream(Image imageToSave, Stream stream, OutputFormat extension, int quality) {
|
||||
ImageFormat imageFormat = null;
|
||||
//bool disposeImage = false;
|
||||
bool disposeImage = false;
|
||||
|
||||
switch (extension) {
|
||||
case OutputFormat.bmp:
|
||||
|
@ -99,18 +99,19 @@ namespace Greenshot.Helpers {
|
|||
imageFormat = ImageFormat.Png;
|
||||
break;
|
||||
}
|
||||
//// If Quantizing is enable, overwrite the image to save with a 256 - color version
|
||||
//if (conf.OutputFileReduceColors) {
|
||||
// try {
|
||||
// LOG.Debug("Reducing colors on bitmap.");
|
||||
// Quantizer quantizer = new OctreeQuantizer(255,8);
|
||||
// imageToSave = quantizer.Quantize(imageToSave);
|
||||
// // 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);
|
||||
// }
|
||||
//}
|
||||
|
||||
// If Quantizing is enable, overwrite the image to save with a 256 - color version
|
||||
if (conf.OutputFileReduceColors) {
|
||||
try {
|
||||
LOG.Debug("Reducing colors on bitmap.");
|
||||
Quantizer quantizer = new OctreeQuantizer(255,8);
|
||||
imageToSave = quantizer.Quantize(imageToSave);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Create meta-data
|
||||
|
@ -137,10 +138,10 @@ namespace Greenshot.Helpers {
|
|||
imageToSave.Save(stream, imageFormat);
|
||||
}
|
||||
} finally {
|
||||
// // cleanup if needed
|
||||
// if (disposeImage && imageToSave != null) {
|
||||
// imageToSave.Dispose();
|
||||
// }
|
||||
// cleanup if needed
|
||||
if (disposeImage && imageToSave != null) {
|
||||
imageToSave.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue