Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

adding a tag to a  jpeg image file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Harris - 28 Feb 2008 20:57 GMT
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
Misbah Arefin - 29 Feb 2008 20:10 GMT
The Image.Save(string, format) is supposed to throw an exception if saved to
the same file it was created from
http://msdn2.microsoft.com/en-us/library/9t4syfhh.aspx

Signature

Misbah Arefin
https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
http://www.linkedin.com/in/misbaharefin

> I have the following code:
>
[quoted text clipped - 22 lines]
> Mark Harris
> St. Petersburg, FL

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.