ImgCopy
Previous  Top  Next

Prototype

IntImage:=ImgCopy(intImageHandle,IntLeft,intTop,intRight,intBottom)

Description

It produces a copy of the image rectangle shown by coordinates.

Parameters

intImageHandle: integer value corresponding to the image handle.
IntLeft,intTop: integer values (they show column and line respectively) corresponding to the corner on the top left of the rectangle.
intRight,intBottom: integer values (they show column and line
respectively) corresponding to the corner on the bottom right of the rectangle.

Returned value

IntImage: integer value corresponding to the image rectangle handle.

Notes

Using four '0' for specifying corners coordinates, the whole image is copied : fullCopy:=ImgCopy(_CurrentImage,0,0,0,0);.

Example
 
//test if image is monochrome  
nBits:=ImgGetBitsPixel(_CurrentImage);  
//if it's not monochrome,   
if nBits>1 then  
begin  
   // copying  the whole image  
   BinaryImage:=ImgCopy(_CurrentImage,0,0,0,0);  
   //thresholding  
   ImgThreshold(BinaryImage,127);  
   //saving  
   NewFileName:=ExtractFilePath(_CurrentOutputFile)+'\Mono'+ExtractFileName(_CurrentOutputFile);  
   tipo:=ExtractFileExt(_CurrentOutputFile);  
   if tipo='.tif' then ImgSaveAsTif(BinaryImage,NewFileName)  
   else if tipo='.jpg' then ImgSaveAsJpg(BinaryImage,NewFileName)  
        else if tipo='.png' then ImgSaveAsPng(BinaryImage,NewFileName)  
         else if tipo='.bmp' then ImgSaveAsBmp(BinaryImage,NewFileName)  
          else ApplicationLog(_CurrentAgent,'Error: '+tipo+' format not supported in output.');  
   //deleting  
   ImgDelete(BinaryImage);  
end;