Understanding ImageBrightness and ImageContrast

Hello,


I’m experimenting with the trial licence for Aspose.Words and I’ve written this code to deal with the attached MS Word document. I realize I’m going to have some information lost going to a Ccitt4, but I’m trying to minimize that lose. How would tweaking ImageBrightness and ImageContrast in the ImageSaveOptions object help me figure out a good happy medium?

var source = new FileInfo(@“TestFiles\Word2013With1Page.docx”);
var output = new FileInfo(source.FullName.Replace(".docx", “.tiff”));
if (output.Exists)
output.Delete();
var doc = new Document(source.FullName);
var saveOptions = new ImageSaveOptions(SaveFormat.Tiff)
{
ImageColorMode = ImageColorMode.BlackAndWhite,
TiffCompression = TiffCompression.Ccitt4,
Resolution = 200,
};
doc.Save(output.FullName, saveOptions);

Any feedback is much appreciated.

Hi Benjamin,


Thanks for your inquiry. Please note that when you use TiffCompression as Ccitt3/Ccitt4, the output image will be black and white.

ImageSaveOptions.ImageContrast property gets or sets the contrast for the generated images. This property has effect only when saving to raster image formats. The default value is 0.5. The value must be in the range between 0 and 1.

ImageSaveOptions.ImageBrightness property gets or sets the brightness for the generated images. This property has effect only when saving to raster image formats. The default value is 0.5. The value must be in the range between 0 and 1.

Please use the values between 0 and 1 for ImageContrast and ImageBrightness properties according to your requirements. Hope this answers your query. Please let us know if you have any more queries.