Read image files
The following example shows how to use GemBox.Imaging to load an image file and read its size and resolution information.
using GemBox.Imaging;
using System;
class Program
{
static void Main()
{
// If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
var imagePath = "%InputFileName%";
using (var image = Image.Load(imagePath))
{
// Display image information.
Console.WriteLine($"Image path: {imagePath}");
Console.WriteLine($"Image size: {image.Width}x{image.Height}");
Console.WriteLine($"Image resolution: {image.DpiX}x{image.DpiY}");
}
}
}
Imports GemBox.Imaging
Imports System
Module Program
Sub Main()
' If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Dim imagePath = "%InputFileName%"
Using image = GemBox.Imaging.Image.Load(imagePath)
' Display image information.
Console.WriteLine($"Image path: {imagePath}")
Console.WriteLine($"Image size: {image.Width}x{image.Height}")
Console.WriteLine($"Image resolution: {image.DpiX}x{image.DpiY}")
End Using
End Sub
End Module