Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.JPG file descriptions. 1

Status
Not open for further replies.

David A

Programmer
Oct 15, 2018
2
0
0
GB
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]
 
Google is your friend. With the terms c# to vb .net converter, this is the first result:


There were many more results. Good luck!

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thanks cery much for the rapid response. Should have thought of Google first!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top