Excel Tiff Generation Take too much time

ASPOSE.CELL Version: 23.2.0.0
Sample Code:

            Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;
            options.HorizontalResolution = 300;
            options.VerticalResolution = 300;
            options.ImageType = Aspose.Cells.Drawing.ImageType.Tiff;
            options.SetDesiredSize(2550, 3100);
            options.PrintingPage = PrintingPageType.IgnoreBlank;
            Workbook _workbook = new Workbook(File.OpenRead("Stuck tiff Generation 01.xlsx"));
            int tiffIndex = 1;
            for (int i = 0; i < _workbook.Worksheets.Count; i++)
            {
                            SheetRender sr = new SheetRender(_workbook.Worksheets[i], options);
            
                            for (int j = 0; j < sr.PageCount; j++)
                            {
                                            sr.ToImage(j, Path.Combine(@"Test" + string.Format("_{0:" + "D6" + "}", tiffIndex + 1) + ".tiff"));
                                            tiffIndex++;
                            }
            }

Please provide any solution for batter performance.

You can take file from the Attachment.
Note: After Generation of 1000 tiff It will take to much time, also I don’t have any storage issue or network issue.
Stuck in EmbeddedExtractor.zip (4.2 MB)

@hemalp
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-53402

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@hemalp

Because TiffCompression.CompressionCCITT4 is set, it will cost lots of time to convert a colorful image to a black-white image. If possible, please try to comment this line.

options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;

Also, please share us more about your environment: e.g. Windows/Linux, used in NetFramework or Net6, Net7.

We can not do it like this because, We have requirement to generate black & white tiff.

OS: Windows 10
Framework: 4.7.2

@hemalp,

Thanks for your feedback and environment details.

We will evaluate your issue further and get back to you soon.

1 Like

@hemalp

On my side, with TiffCompression.CompressionCCITT4 is set, I didn’t see the difference between the cost time of generating tiff images(1-100) and the cost time of generating tiff image(1001-1100).

Since there are thousands of images and converting a colorful image to a black-white image is costing time, the whole conversion needs lots of time.

So, Can you Provide any method witch can generate B&W tiff in faster way.

@hemalp

We need to evaluate it more to see whether there are some faster algorithms to convert a colorful image to a black-white image. However, a faster algorithms may generate a poor black-white image.

If we have some progress, we will update you here.

@hemalp

I am investigating a faster implementation. However, it is unfriendly for background color, the background will be totally white or black. In this case, the cell text may be mixed into the background. e.g. cell text is converted to black color and background is also converted to black color too. Can you accept the result in this case?

Please check the generated first page and screenshot that highlight the difference:FasterResult.zip (1.0 MB)

@peyton.xu
I also try with
xlSheet.PageSetup.BlackAndWhite = true;
But Still Tiff Generation Take time.

@hemalp

Could you please try to comment the TiffCompression setting and set TiffColorDepth to 1bpp?

//options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;
options.TiffColorDepth = ColorDepth.Format1bpp;

Please let us know your feedback.

Hi Team,

So to faster result, we have to remove CCIT compression ?
will there is no way, we can generate faster output with CCIT compression for BW TIF creation?

@hemalp

We can provide an option that can generate BW Tiff with CCITT compression if you can accept the result.
Please note the cell text may be mixed into the background. e.g. cell text is converted to black color and background is also converted to black color too.

Hi,

Yes, we can accept the given result.
Can you provide an option to generate BW tiff with CCIT compression.

Thanks

@hemalp,

Thanks for accepting the proposed option and results. We will be looking into it and implement it soon.

Once we have an update on it, we will let you know.

@hemalp

We will add a new API ImageOrPrintOptions.TiffBinarizationMethod to specify the method used while converting images to 1 bpp format.
So the specified ImageOrPrintOptions will be:

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;

//specify Threshold method used while converting images to 1 bpp format
options.TiffBinarizationMethod = ImageBinarizationMethod.Threshold;

options.HorizontalResolution = 300;
options.VerticalResolution = 300;
options.ImageType = Aspose.Cells.Drawing.ImageType.Tiff;
options.SetDesiredSize(2550, 3100, false);
options.PrintingPage = PrintingPageType.IgnoreBlank;

Hi @peyton.xu

When can I get updated aspose version having property name options.TiffBinarizationMethod ?

Thanks

@hemalp,

The new feature/enhancement will be included in our upcoming release (Aspose.Cells v23.6) that we plan to release before the end of this week. You will be notified when the next version is released.

Thanks @amjad.sahi for update!!

@hemalp,
You are welcome.