Can resize image with FREngine

  • 1.2K Views
  • Last Post 16 June 2015
FKucuk posted this 11 June 2015

Hi,

We use FREngine10 to make ocr images. I need to resize images when program converts pdf file to tiff. I checked documentation but can't find anything about resizing image. I can change resoulution but i dont change image width and hight

Here is a sample;

IMultipageImageWriter writer = ImageProcessingEngine.FREngine.CreateMultipageImageWriter(convertedFilename, format); FRDocument frDoc = ImageProcessingEngine.FREngine.CreateFRDocumentFromImage(originalFile); try { int pagesCount = frDoc.Pages.Count; int height = 0, width = 0; for (int i = 0; i < pagesCount; i++) { FREngine.Image img = frDoc.Pages.ImageDocument.ColorImage; writer.AddPage(img); } } finally { Marshal.ReleaseComObject(writer); writer = null; frDoc.Close(); frDoc = null; if (!saveOriginalFile && File.Exists(originalFile)) { File.Delete(originalFile); } }

Oksana Serdyuk posted this 16 June 2015

There are two ways to change the prepared image: either using the OverwriteResolution property of the PrepareImageMode object, or using the StretchRatio property of the ImageModification object. Pay your attention that there is the difference between the OverwriteResolution and the StretchRatio properties:

The main property of image for the FREngine is the image size in pixels. The image resolution (in terms of FREngine) determines the physical size (in inch, cm and so on) of the image. So, in case of using the OverwriteResolution property FREngine changes the resolution of image but does not change the quantity of physical pixels. In compare to OverwriteResolution, the StretchRatio property changes both the resolution and the pixels quantity of the image.

Also please see the Help file for your information: API Reference > Image-Related Objects > PrepareImageMode and ImageModification sections correspondingly.

What way is more suitable for you depends on your usage scenario.

  • Liked by
  • hakanaktan
Close