GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / RemoveHolePunch Method / RemoveHolePunch(Int32,HolePunchMargins) Method
GdPicture image identifier.

Be aware that only 1, 8 and 24 bit per pixel images are supported.

A member of the HolePunchMargins enumeration. The required image margin you want to repair.

You can combine margins using the "OR" operator, as it is shown in the example below.

Example





In This Topic
RemoveHolePunch(Int32,HolePunchMargins) Method
In This Topic
Removes all punch holes situated on the exactly specified margin of the image. This method allows you to remove both circle and rectangle punch holes, as well as the punch holes that looks like a part of the circle (residuals of holes). You are able to select the specific margin of your image. The image you want to process can be black and white, grayscale and colored as well.
Syntax
'Declaration
 
Public Overloads Function RemoveHolePunch( _
   ByVal ImageID As Integer, _
   ByVal Margins As HolePunchMargins _
) As GdPictureStatus
public GdPictureStatus RemoveHolePunch( 
   int ImageID,
   HolePunchMargins Margins
)
public function RemoveHolePunch( 
    ImageID: Integer;
    Margins: HolePunchMargins
): GdPictureStatus; 
public function RemoveHolePunch( 
   ImageID : int,
   Margins : HolePunchMargins
) : GdPictureStatus;
public: GdPictureStatus RemoveHolePunch( 
   int ImageID,
   HolePunchMargins Margins
) 
public:
GdPictureStatus RemoveHolePunch( 
   int ImageID,
   HolePunchMargins Margins
) 

Parameters

ImageID
GdPicture image identifier.

Be aware that only 1, 8 and 24 bit per pixel images are supported.

Margins
A member of the HolePunchMargins enumeration. The required image margin you want to repair.

You can combine margins using the "OR" operator, as it is shown in the example below.

Return Value

A member of the GdPictureStatus enumeration.

If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.

This method requires the Image Documents component to run.

Remarks
Just to remind you that you can use the binary operator "OR" with HolePunchMargins enumerations to specify more than one margin at the same time.

This method is used in the "Image Processing Sample" and the "Document Clean Up Sample", both are C# demo applications. Please read the sections "Learning GdPicture.NET" and "Programming" in the GdPicture reference guide for further information on this feature.

Example
Removes punch holes from a bitonal tiff image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("bitonal.tif", false);
    gdpictureImaging.RemoveHolePunch(imageID, HolePunchMargins.MarginLeft | HolePunchMargins.MarginRight);
    gdpictureImaging.SaveAsTIFF(imageID, "processed_image.tif", TiffCompression.TiffCompressionCCITT4);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also