[FREngine 11] how export zoned images to jpg

  • 1.1K Views
  • Last Post 09 November 2015
vbknight posted this 25 November 2013

how can i export zone layout as clip image format like jpeg?

Order By: Standard | Newest | Votes
Anastasia Galimova posted this 05 December 2013

Do I understand correctly that you need to draw block rectangles on your image?

You can use the following recommendations from our Knowledge Base: Drawing Blocks.

Andres Muñoz posted this 09 November 2015

Hello,

I did this:


var imgCropped = CropImage(_strPathOfOriginalImage, new Rectangle(intLeft, intTop, (intRight - intLeft), (intBottom - intTop)));
var strPathToCroppedImage = "D:\" + Guid.NewGuid() + ".jpg";
//Save file to disk 
imgCropped.Save(strPathToCroppedImage);
imgCropped.Dispose();
System.Diagnostics.Process.Start(strPathToCroppedImage);
And CropImage:

private System.Drawing.Image CropImage(string strSource, Rectangle recArea)
{
    Bitmap bmpCropped = null;
    using (var bmpOriginalImage = new Bitmap(strSource))
    {
        bmpCropped = bmpOriginalImage.Clone(recArea,bmpOriginalImage.PibmpImagenOriginal);
    }
    return bmpCropped;
}
 

This is how I determine what to crop (min left, min top, max right, max bottom of all selected regions):

var intLeft = 0;
var intTop = 0;
var intRight = 0;
var intBottom = 0;
var intBlockCount = frDocument.Pages[0].Layout.Blocks.Count;
for (int iblock = 0; iblock < intBlockCount; iblock++)
{
    IBlock IBlockObject = frDocument.Pages[0].Layout.Blocks.Item(iblock);
    for (int iregion = 0; iregion < IBlockObject.Region.Count; iregion++)
    {
        intLeft = (intLeft == 0 || intLeft > IBlockObject.Region.Left[iregion]) ? IBlockObject.Region.Left[iregion] : intLeft;
        intTop = (intTop == 0 || intTop > IBlockObject.Region.Top[iregion]) ? IBlockObject.Region.Top[iregion] : intTop;
        intRight = (intRight == 0 || intRight < IBlockObject.Region.Right[iregion]) ? IBlockObject.Region.Right[iregion] : intRight;
        intBottom = (intBottom == 0 || intBottom < IBlockObject.Region.Bottom[iregion]) ? IBlockObject.Region.Bottom[iregion] : intBottom;
    }
}

Close