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

asked 25 Nov '13, 14:04

vbknight's gravatar image

vbknight
3115

edited 05 Dec '13, 10:54

Anastasia%20Galimova's gravatar image

Anastasia Ga... ♦♦
790112


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.

link

answered 05 Dec '13, 11:01

Anastasia%20Galimova's gravatar image

Anastasia Ga... ♦♦
790112

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;
    }
}

link

answered 09 Nov '15, 19:25

Andres%20Mu%C3%B1oz's gravatar image

Andres Muñoz
215

edited 09 Nov '15, 19:39

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×21
×1
×1
×1
×1

Asked: 25 Nov '13, 14:04

Seen: 1,086 times

Last updated: 09 Nov '15, 19:39

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal