I am trying to retrieve .JPG file descriptions, (e.g. camera type) using VB .NET. The closest I have found is the C# code below. Would it be possible for someone to either translate this, or point me in the direction of equivalent VB .NET code?
Thanks in anticipation
// Create an Image object.
Image image = new Bitmap(@"c:\FakePhoto.jpg");[/color]
// Get the PropertyItems property from image.
PropertyItem[] propItems = image.PropertyItems;
// Set up the display.
Font font = new Font("Arial", 12);
SolidBrush blackBrush = new SolidBrush(Color.Black);
int X = 0;
int Y = 0;
// For each PropertyItem in the array, display the ID, type, and
// length.
int count = 0;
foreach (PropertyItem propItem in propItems)
{
e.Graphics.DrawString(
"Property Item " + count.ToString(),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" iD: 0x" + propItem.Id.ToString("x"),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" type: " + propItem.Type.ToString(),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" length: " + propItem.Len.ToString() + " bytes",
font,
blackBrush,
X, Y);
Y += font.Height;
count++;
}
// Convert the value of the second property to a string, and display
// it.
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string manufacturer = encoding.GetString(propItems[1].Value);
e.Graphics.DrawString(
"The equipment make is " + manufacturer + ".",
font,
blackBrush,
X, Y);[/highlight]
Thanks in anticipation
// Create an Image object.
Image image = new Bitmap(@"c:\FakePhoto.jpg");[/color]
// Get the PropertyItems property from image.
PropertyItem[] propItems = image.PropertyItems;
// Set up the display.
Font font = new Font("Arial", 12);
SolidBrush blackBrush = new SolidBrush(Color.Black);
int X = 0;
int Y = 0;
// For each PropertyItem in the array, display the ID, type, and
// length.
int count = 0;
foreach (PropertyItem propItem in propItems)
{
e.Graphics.DrawString(
"Property Item " + count.ToString(),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" iD: 0x" + propItem.Id.ToString("x"),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" type: " + propItem.Type.ToString(),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" length: " + propItem.Len.ToString() + " bytes",
font,
blackBrush,
X, Y);
Y += font.Height;
count++;
}
// Convert the value of the second property to a string, and display
// it.
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string manufacturer = encoding.GetString(propItems[1].Value);
e.Graphics.DrawString(
"The equipment make is " + manufacturer + ".",
font,
blackBrush,
X, Y);[/highlight]