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="Controls" />
|
||||||
<Folder Include="Helpers\IEInterop" />
|
<Folder Include="Helpers\IEInterop" />
|
||||||
<Folder Include="Memento" />
|
<Folder Include="Memento" />
|
||||||
<Folder Include="Helpers\OfficeInterop" />
|
|
||||||
<Folder Include="Lib" />
|
<Folder Include="Lib" />
|
||||||
<Folder Include="Languages" />
|
<Folder Include="Languages" />
|
||||||
<Folder Include="Help" />
|
<Folder Include="Help" />
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Greenshot.Helpers {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SaveToStream(Image imageToSave, Stream stream, OutputFormat extension, int quality) {
|
public static void SaveToStream(Image imageToSave, Stream stream, OutputFormat extension, int quality) {
|
||||||
ImageFormat imageFormat = null;
|
ImageFormat imageFormat = null;
|
||||||
//bool disposeImage = false;
|
bool disposeImage = false;
|
||||||
|
|
||||||
switch (extension) {
|
switch (extension) {
|
||||||
case OutputFormat.bmp:
|
case OutputFormat.bmp:
|
||||||
|
@ -99,18 +99,19 @@ namespace Greenshot.Helpers {
|
||||||
imageFormat = ImageFormat.Png;
|
imageFormat = ImageFormat.Png;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//// If Quantizing is enable, overwrite the image to save with a 256 - color version
|
|
||||||
//if (conf.OutputFileReduceColors) {
|
// If Quantizing is enable, overwrite the image to save with a 256 - color version
|
||||||
// try {
|
if (conf.OutputFileReduceColors) {
|
||||||
// LOG.Debug("Reducing colors on bitmap.");
|
try {
|
||||||
// Quantizer quantizer = new OctreeQuantizer(255,8);
|
LOG.Debug("Reducing colors on bitmap.");
|
||||||
// imageToSave = quantizer.Quantize(imageToSave);
|
Quantizer quantizer = new OctreeQuantizer(255,8);
|
||||||
// // Make sure the "new" image is disposed
|
imageToSave = quantizer.Quantize(imageToSave);
|
||||||
// disposeImage = true;
|
// Make sure the "new" image is disposed
|
||||||
// } catch(Exception e) {
|
disposeImage = true;
|
||||||
// LOG.Warn("Error occurred while Quantizing the image, ignoring and using original. Error: ", e);
|
} catch(Exception e) {
|
||||||
// }
|
LOG.Warn("Error occurred while Quantizing the image, ignoring and using original. Error: ", e);
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create meta-data
|
// Create meta-data
|
||||||
|
@ -137,10 +138,10 @@ namespace Greenshot.Helpers {
|
||||||
imageToSave.Save(stream, imageFormat);
|
imageToSave.Save(stream, imageFormat);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// // cleanup if needed
|
// cleanup if needed
|
||||||
// if (disposeImage && imageToSave != null) {
|
if (disposeImage && imageToSave != null) {
|
||||||
// imageToSave.Dispose();
|
imageToSave.Dispose();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue