GetHeight Method (GdPictureImaging)
 
            
                In This Topic
            
            
            Returns the heightof a GdPicture image in pixels.
            
            
            
            Syntax
            
            
            
            
            'Declaration
 
Public Function GetHeight( _
   ByVal  As Integer _
) As Integer
             
        
            
            public int GetHeight( 
   int 
)
             
        
            
            public function GetHeight( 
    : Integer
): Integer; 
             
        
            
            public function GetHeight( 
    : int
) : int;
             
        
            
            public: int GetHeight( 
   int 
) 
             
        
            
            public:
int GetHeight( 
   int 
) 
             
        
             
        
            Parameters
- ImageID
 
- GdPicture image identifier.
 
            
            Return Value
            Height in pixels.
            
 
            
            
            
            
            
            Example
Utilizing the height of an image when processing it.
            
             
Cropping from a jpeg image.
    
	
		using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
 
    // Remove 5% all around the image.
    int height = gdpictureImaging.GetHeight(imageID);
    int width = gdpictureImaging.GetWidth(imageID);
    gdpictureImaging.Crop(imageID, width * 5 / 100, height * 5 / 100, width * 90 / 100, height * 90 / 100);
    
    gdpictureImaging.SaveAsPNG(imageID, "crop.png");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
	 
	
 
Getting the red channel histogram of a jpeg image and creating an image representing this histogram.
    
	
		using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg", false);
 
    // Get the red channel histogram and the image dimensions.
    int[] histo = new int[256];
    gdpictureImaging.HistogramGetRed(imageID, ref histo);
    int count = gdpictureImaging.GetWidth(imageID) * gdpictureImaging.GetHeight(imageID);
 
    gdpictureImaging.ReleaseGdPictureImage(imageID);
 
    // Create an image representing the histogram. 
    // The image has the same width as the histogram and its height is 1000.                
    int histogramID = gdpictureImaging.CreateNewGdPictureImage(256, 1000, 24, Color.White);
    for (int i = 0; i < 256; i++)
    {
        int value = histo[i] * 1000 / count;
        for (int j = 0; j < value; j++)
        {
            gdpictureImaging.PixelSetColor(histogramID, i, j, Color.Red);
        }
    }
 
    gdpictureImaging.SaveAsPNG(histogramID, "histo.png");
    gdpictureImaging.ReleaseGdPictureImage(histogramID);
}
	 
	
 
 
            
            Example
Utilizing the height of an image when processing it.
            
            using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
            {
                int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
             
                // Remove 5% all around the image.
                int height = gdpictureImaging.GetHeight(imageID);
                int width = gdpictureImaging.GetWidth(imageID);
                gdpictureImaging.Crop(imageID, width * 5 / 100, height * 5 / 100, width * 90 / 100, height * 90 / 100);
                
                gdpictureImaging.SaveAsPNG(imageID, "crop.png");
                gdpictureImaging.ReleaseGdPictureImage(imageID);
            }
            using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
            {
                int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg", false);
             
                // Get the red channel histogram and the image dimensions.
                int[] histo = new int[256];
                gdpictureImaging.HistogramGetRed(imageID, ref histo);
                int count = gdpictureImaging.GetWidth(imageID) * gdpictureImaging.GetHeight(imageID);
             
                gdpictureImaging.ReleaseGdPictureImage(imageID);
             
                // Create an image representing the histogram. 
                // The image has the same width as the histogram and its height is 1000.                
                int histogramID = gdpictureImaging.CreateNewGdPictureImage(256, 1000, 24, Color.White);
                for (int i = 0; i < 256; i++)
                {
                    int value = histo[i] * 1000 / count;
                    for (int j = 0; j < value; j++)
                    {
                        gdpictureImaging.PixelSetColor(histogramID, i, j, Color.Red);
                    }
                }
             
                gdpictureImaging.SaveAsPNG(histogramID, "histo.png");
                gdpictureImaging.ReleaseGdPictureImage(histogramID);
            }
            
            
            See Also