How do I edit JPG File Title, Subject, Comments, and Tags/Keywords?

假装没事ソ 提交于 2019-12-05 17:59:38

I can only offer you a starting point, since I don't use VB.Net and I only read EXIF data. In C#, if you open file in a System.Drawing.Image instance using:

Image image = System.Drawing.Image.FromFile("path/to/file.jpg");

You can access the raw EXIF data by using image.GetPropertyItem(0x0112), where the list of all available property items are listed here:

http://msdn.microsoft.com/en-us/library/ms534418%28VS.85%29.aspx

Likewise, there's an image.SetPropertyItem(0x0112) method, but I think that will only set it in memory and you will have to save a copy of the image in order to write it out. I think what you want though is the ability to modify the EXIF without touching the actual image, which I do not know how to do.

Using metadata

As I've said in my comment, I recommend that instead of editing the image header information, you should create a Media class that holds that kind of information:

public class Media
{
    public string Title { get; set; }
    public string Subject { get; set; }
    public string Comments { get; set; }
    public string[] Tags { get; set; }
    public string PathToFile { get; set; }
}

Then you would store this record in the database, which makes it really easy to search on. If you need the actual file, use the PathToFile property to locate it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!