Highlighting text

You can highlight text in a source image. To do so:

  1. Create a region where the text should be highlighted. You can either set its coordinates manually or acquire them automatically as described in Text Coordinates article.
  2. Create an ImageModification object and add a paint region and a replace black pixels region to it.
  3. Modify the image and save it.

Sample Code in C#

//load image
FREngine.FRDocument document = engineLoader.Engine.CreateFRDocumentFromImage(@"D:\Demo.tif");

//create the region where the text should be highlighted
FREngine.Region region = engineLoader.Engine.CreateRegion();
region.AddRect(350,280,1000,350);

//create ImageModificaton object and add paint region and “replace black pixels region” to it
FREngine.ImageModification imageModification = engineLoader.Engine.CreateImageModification();
imageModification.AddPaintRegion(region, 255);
imageModification.AddReplaceBlackPixelsRegion(region, 0);

//modify the image and save it
document.Pages[0].ImageDocument.ColorImage.WriteToFile(@"D:\highlighted.tif",
FREngine.ImageFileFormatEnum.IFF_TiffColorLZW, imageModification);

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Recently viewed