Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good time! I'm trying to solve the problem of changing the value PropertyTagImageDescription (0x010E) for the Bitmap object. To add a description for the file. Searching the related topics, and has not found the solution. My use:

C#
Bitmap image = new Bitmap(Image.FromFile(fileName));
    var data = System.Text.Encoding.UTF8.GetBytes("My comment");
    PropertyItem propItem = image.GetPropertyItem(Convert.ToInt32(0x010E));
    propItem.Len = data.Length;
    propItem.Value = data;
    image.SetPropertyItem(propItem);


But there is an error : "In GDI + error occurred generic."

Help me understand! What I'm doing wrong?
Posted
Updated 11-Jan-13 12:35pm
v4

1 solution

Check whether the property you are looking is valid for the image. If PropertyItems collection is empty you will end up with this error. read more here[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900