Free Support Forum -

Color compression and Color Reduction


How to apply color compression and color reduction (blank and white, color or gray) properties while converting powerpoint, Pdf and Excel documents to Tiff format using Aspose SDKs. Please provide me the sample code as well.




I am a representative of Aspose.Cells, I would help you regarding converting Excel worksheets to Tiff images. I think you may try to use PageSetup features for your desired printing options. Moreover, you may also use ImageOrPrintOptions attributes according to your needs.

See the sample code below for your reference.

Sample code:
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(“e:\test2\MyFile.xlsx”, new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Xlsx));
Aspose.Cells.Worksheet sheet = workbook.Worksheets[0];
//Apply Excel’s PageSetup features
//Print all the sheet
sheet.PageSetup.PrintArea = “”;
//Set Black and White mode
sheet.PageSetup.BlackAndWhite = true;
//Set the print quality
sheet.PageSetup.PrintQuality = 180;
//Set ImageOrPrintOptions
//Apply different Image and Print options
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
//Set Horizontal Resolution
options.HorizontalResolution = 300;
//Set Vertical Resolution
options.VerticalResolution = 300;
//Set TiffCompression
options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionLZW;
//Set Autofit options
options.IsCellAutoFit = false;
//Set Image Format
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff;
//Set printing page type
//options.PrintingPage = Aspose.Cells.PrintingPageType.Default;
//options.OnePagePerSheet = true;
//Render the sheet with respect to specified image/print options
Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, options);
//Render/save the image for the sheet
for (int i = 0; i < sr.PageCount; i++)
sr.ToImage(i, “e:\test2\test_image_” + sheet.CodeName + “_” + i + “.tif”);

Also, see the documents for your complete reference:

Thank you.

Hi Dhivya,

You can use Aspose.Pdf for .NET to convert PDF files to TIFF images. You can also specify different settings using TiffSettings class, including color depth and compression, while saving the PDF as TIFF file. Please see the following topic for details and code sample:
Convert PDF to TIFF Image using Different Settings

I hope this helps. If you find any further questions, please do let us know.