adding a tag to a jpeg image file

M

Mark Harris

I have the following code:

try
{

fi = new FileInfo(fn); //fn is a string from a windows form,
identifying the jpg in the file system
fullPath = fi.DirectoryName + "\\" + fi.Name;
Image bm = Image.FromFile(fullPath, true); //create an image
object from the file identifier
//bm.Tag = txtTag.Text; -- various attempts to set the
Image.Tag, inactivated for this test
//bm.Tag = (object)txtTag.Text;

bm.Save(fullPath, jpg); //this generates a "generic GDI+
error, trapped by a catch block on
//an unspecified exception -- catch(Exception ex)
}

//end code sample
//since I am in the code above merely loading the jpg and trying to save it
without any modification, I don't quite understand what has caused the
error. Any advice appreciated. I'm a neophyte at C#.

Mark Harris
St. Petersburg, FL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top