I am using Aspose Cells for rendering an excel file that contains a image as a png file. When doing this, I noticed that the properties of the image are not preserved (I attached the initial excel file and the resulted image). This problem has been previously posted as “Image brightness not preserved when rendering image from excel” and “Image contrast not preserved when rendering image from excel”. The last one appears as fixed in version 7.5.0. I tested it with 8.0-8.2 versions and the output is the same. Here is the code for this:
const string filePath = @“C:\image_brightness.xlsx”;
var workbook = new Workbook(filePath);
var imageOptions = new ImageOrPrintOptions
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true
var worksheet = workbook.Worksheets;
string printArea = string.Format(“D2:T42”);
worksheet.PageSetup.PrintArea = printArea;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
var sheetRender = new SheetRender(worksheet, imageOptions);
sheetRender.ToImage(0, filePath + “.out.png”);
Thanks for your posting and using Aspose.Cells.
We were able to replicate this issue using the latest version: Aspose.Cells
for .NET v184.108.40.206. The image brightness is lost after image is rendered from Excel.
We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as
- CELLSNET-42984 - Image brightness is lost when rendering image from Excel
We have tested this issue with the following code. I have attached the Excel generated PDF and Aspose.Cells generated PDF and screenshot highlighting this issue for a reference.
string filePath = @“F:\Shak-Data-RW\Downloads\input.xlsx”;
Workbook workbook = new Workbook(filePath);
workbook.Save(filePath + “.out.pdf”);
Thanks for your using Aspose.Cells.
Please download and try the latest fix: Aspose.Cells for .NET v220.127.116.11 and let us know your feedback.