PropertyTagImageDescription的Сhange值(位图/ C#) [英] Сhange value of PropertyTagImageDescription (Bitmap/C#)
本文介绍了PropertyTagImageDescription的Сhange值(位图/ C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好时光!我正在尝试解决为Bitmap对象更改值PropertyTagImageDescription(0x010E)的问题。添加文件的描述。搜索相关主题,并没有找到解决方案。我的用途:
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:
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);
但是有一个错误:在GDI +中发生错误通用。< br $> b $ b
帮助我理解!我做错了什么?
But there is an error : "In GDI + error occurred generic."
Help me understand! What I''m doing wrong?
推荐答案
检查您正在寻找的属性是否对图像有效。如果PropertyItems集合为空,则最终会出现此错误。阅读更多此处 [ ^ ]
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[^]
这篇关于PropertyTagImageDescription的Сhange值(位图/ C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文