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