ImgDelete
Previous  Top  Next

Prototype

ImgDelete(intImageHandle)

Description

It deletes an image from memory.

Parameters

intImageHandle: integer value corresponding to the image handle.

Returned value

None.

Notes

Its very important to use this function to remove from memory images allocated using other functions as ImgOpen or ImgCopy. After calling this function the image handle will be invalid and should be not used.


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;