GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / SetContrast Method
GdPicture image identifier.
Contrast adjustment between -100 and 100.
Example





In This Topic
SetContrast Method (GdPictureImaging)
In This Topic
Adjust the Contrast in a GdPicture image or in the area defined by SetROI() method.
Syntax
'Declaration
 
Public Function SetContrast( _
   ByVal ImageID As Integer, _
   ByVal Contrast As Integer _
) As GdPictureStatus
public GdPictureStatus SetContrast( 
   int ImageID,
   int Contrast
)
public function SetContrast( 
    ImageID: Integer;
    Contrast: Integer
): GdPictureStatus; 
public function SetContrast( 
   ImageID : int,
   Contrast : int
) : GdPictureStatus;
public: GdPictureStatus SetContrast( 
   int ImageID,
   int Contrast
) 
public:
GdPictureStatus SetContrast( 
   int ImageID,
   int Contrast
) 

Parameters

ImageID
GdPicture image identifier.
Contrast
Contrast adjustment between -100 and 100.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
This method is used in the "Image Processing" Demo.
Example
Change image contrast using random value and saves result into a PNG file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("input.png");
 
    // Change image contrast using random value. Allowed values are from -100 to +100.
    Random random = new Random();
    int contrast = random.Next(-100, 100);
    gdpictureImaging.SetContrast(imageID, contrast);
 
    gdpictureImaging.SaveAsPNG(imageID, "output.png");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also