Get Bytes of the rectangle of area selection over the page

Discussions about image processing and document imaging.
Post Reply
gtoledo
Posts: 45
Joined: Thu May 28, 2009 7:30 pm

Get Bytes of the rectangle of area selection over the page

Post by gtoledo » Wed Feb 04, 2015 1:49 am

Hi,

I request your support to know if the following procedure is right for trimming the area of a picture and get the value in bits of the selected area.

1. I made a new image from a Multipage TIFF image file with the method CreateGdPictureImageFromFile.

2. Using the mouse, drawing a rectangle with the "Area Selection Tool".

3. When clicking on button, call the "MyFunction" function (Annex Code), which gets the coordinates (left, top, width and height), of the rectangle of area selection over the page of the displayed document.

- Create a new GdPicture Image using the metodo CreateClonedGdPictureImageArea()

- From the ID of the new image we get the bits with GetBits()

Regards...

Code: Select all

var nMultipageTiffImage;

    function MyFunction() {

        nMultipageTiffImage = oGdImaging.CreateGdPictureImageFromFile('');

        var left = oGdViewer.GetRectLeftOnDocument();
        var top = oGdViewer.GetRectTopOnDocument();
        var width = oGdViewer.GetRectWidthOnDocument();
        var height = oGdViewer.GetRectHeightOnDocument();

        var ImageClonedID
        ImageClonedID = oGdImaging.CreateClonedGdPictureImageArea(nMultipageTiffImage, left, top, width, height);

        var ImgBits = oGdImaging.GetBits(ImageCloned);

        var ImgBytes = (ImgBits / 8);
        var Imgkbyte = (ImgBits / 1024);
        var ImgMbyte = (ImgBits / 1024) / 1024;

        oGdImaging.ReleaseGdPictureImage(ImageCloned)

        result = 'Bits: ' + ImgBits + '\n\n'
        result += 'Bytes: ' + ImgBytes + '\n\n'
        result += 'Kilobytes: ' + Imgkbyte + '\n\n'
        result += 'Megabyte: ' + ImgMbyte + '\n\n'

        alert(result);

    }
I have a multipage file with several pages of different sizes and another file with a blank letter-size page. Attempt to merge with the multipage letter size page, someone can help me?

gtoledo
Posts: 45
Joined: Thu May 28, 2009 7:30 pm

Re: Get Bytes of the rectangle of area selection over the pa

Post by gtoledo » Wed Feb 11, 2015 6:22 pm

Comments or suggestions?
I have a multipage file with several pages of different sizes and another file with a blank letter-size page. Attempt to merge with the multipage letter size page, someone can help me?

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Get Bytes of the rectangle of area selection over the pa

Post by SamiKharma » Thu Feb 12, 2015 7:46 am

Hi,

For the most part you are correct, two comments though:
1. Check if there is a rectangle of selection to begin with using GdViewer.IsRect
2. You can get the coordinates in one function instead of four: http://guides.gdpicture.com/content/web ... nt32).html

Best,
Sami

gtoledo
Posts: 45
Joined: Thu May 28, 2009 7:30 pm

Re: Get Bytes of the rectangle of area selection over the pa

Post by gtoledo » Thu Feb 12, 2015 4:34 pm

I will follow your recomendations.

Thanks for your reply.

Regards...
I have a multipage file with several pages of different sizes and another file with a blank letter-size page. Attempt to merge with the multipage letter size page, someone can help me?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest