Image size exceeds limits (32512 x 32512)

  • 120 Views
  • Last Post 16 January 2018
b.ehrhardt posted this 03 January 2018

I receive an error during the pdf conversion, which states that the maximum image size has been reached (32512 x 32512). Is there a trick to still convert those big images?
Thanks in advance.

Order By: Standard | Newest | Votes
Kseniya Leontyeva posted this 03 January 2018

Hi, 

If the image size reached this number because of a good quality, then the size can be reduced by reducing image resolution as in this C# example code:

                FREngine.PrepareImageMode pim = engineLoader.Engine.CreatePrepareImageMode();

                pim.OverwriteResolution = true;

                pim.XResolutionToOverwrite = 100;

                pim.YResolutionToOverwrite = 100;

 

                FREngine.FRDocument wDocument = engineLoader.Engine.CreateFRDocument();

                wDocument.AddImageFile(inPathPDF, pim, null);

 

XResolutionToOvewrite and YResolutionToOvewrite is a resolution in dpi you can vary it to achieve better quality.

To read more about recommended resolutions you can read Developer's Help → Guided Tour → Advanced Techniques → Best Practices → Image Recommendations.

b.ehrhardt posted this 03 January 2018

Hi,

Thanks for the quick answer, I was afraid of the content. With about 180000 files to be converted, some of which will be too large, this will not be feasible.
We will see.

b.ehrhardt posted this 03 January 2018

Oh,

thanks a lot for the second answer. I will test it tomorrow. I wish a nice evening.

b.ehrhardt posted this 04 January 2018

Hi,

This works well for good quality pdf files, but does not work for files with poor source quality, then the result will be even worse. My problem is that I also have files with poor quality and a format of about 100mm * 5000mm and only one page.
How can I determine the resolution of pdf files? The method FRPage.DetectResolution probably only works if the image has already been added.

Thank you for your efforts.

Kseniya Leontyeva posted this 10 January 2018

Hi again, 

In this case, you can get the information about the original resolution by SourceImageXResolution and SourceImageYResolution properties of the ImageDocument object. However, if this information somehow unavailable the return value would be 0, so I guess, this case should also be taken into consideration.

Simple example code for one-page document:

                    FREngine.ImageDocument imageDocument = document.Pages[0].ImageDocument;

                    var xResolution = imageDocument.SourceImageXResolution;

b.ehrhardt posted this 10 January 2018

Hello Kseniya,


Thank you for your suggestion. Unfortunately, it does not help me much, because I do not even come to see the resolution of the page.
From ABBYY Europe I got the suggestion to print the documents and to scan again with low resolution, funny or.
We'll tell the customer about the problems with 1% of his files, and he'll decide how to proceed.

Thanks again for your efforts.

            Code with exception:

                        FRDocument doc = engine.CreateFRDocument();

                        try

                        {

                            doc.AddImageFile(pdfFile); // Here already throw the exception

                            var imageDocument = doc.Pages[0].ImageDocument;

                            var xResolution = imageDocument.SourceImageXResolution;

                             // and so on

                            doc.Process();

                            doc.Export(fileOut, FREngine.FileExportFormatEnum.FEF_PDF, pdfParams);

                        }

                        catch () { }

 

Kseniya Leontyeva posted this 16 January 2018

Thank you for the feedback.

Also, I came up with sort of workaround. It looks as follows:

1) Load the image in memory by some another tool, that allows loading images of any sizes.

2) Check it for exceeding the limit.

3) Load it to the FineReader Engine using Engine::OpenBitmap method.

Close