如何编辑JPG文件标题

如何编辑JPG文件标题

本文介绍了如何编辑JPG文件标题,主题,注释和标签/关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编辑JPG文件标题,主题,注释和标签/关键字?*

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

我已经尝试过问这个问题这里:

I have already tried asking this question here:

提供的Exif信息很有帮助,但最终并没有真​​正解决我正在研究的真正难题.因此,我将从另一个角度来描述所需的结果:

The Exif information provided was helpful, but in the end did not actually solve the real riddle I was working on. So I'll take another angle at describing the desired result:

我希望我的VB.NET应用程序允许我编辑Jfile的以下详细信息(见图片):

I want my VB.NET app to allow me to edit the following details of a Jfile (see image):

标题,主题,评论和标签/关键字

Title, Subject, Comments, and Tags/Keyowrds

在窗口中右击.JPG并选择属性"

RIGHT CLICK A .JPG IN WINDOWS and select PROPERTIES

任何人都可以解释如何在Visual Studio中通过VB.net编辑这些字段吗?

Can anyone explain how to edit those fields through VB.net in Visual Studio?

最终目标是使用我构建的图像查看器/编辑器,对我多年来收集的成千上万张随机Web垃圾图像进行分类.在查看图像(比如说"00001.jpg")并弄清楚它是什么(吊顶猫送儿子"大声笑猫的图片)之后,我要输入说明(已在表格中完成).当我按Enter键时,我想将文件重命名(从"00001.jpg"重命名为"ceiling-cat-sends-son.jpg",然后用相同的数据填写关键字,标题,主题和注释字段:天花板猫送儿子".

The ultimate goal is to use the image viewer/editer that I built, to sort thousands of images of random webjunk I have collected over the years.Upon viewing the image (say "00001.jpg") and figureing out what it is ("ceiling cat sends son" picture of a lol cat), I want to type in the description (already done in the form). When I hit enter I want to rename the file (from "00001.jpg" to "ceiling-cat-sends-son.jpg", then fill in the keywords, title, subject, and comments fields with the same data: "ceiling cat sends son".

这将有助于本地索引编制,以及(稍后)使SQL Server引用数据库自​​动化以供在我的网站上进行站点范围内的搜索时使用.我似乎无法弄清的唯一事情就是如何修改这四个字段,就像我右键单击文件并添加关键字一样.

This will help with local indexing and with my (later) automating a SQL server referential database for use with site wide searches on my website. The ONLY thing I can't seem to figure out is how to modify those four fields as if I had right-clicked the file and added the keywords.

推荐答案

由于我不使用VB.Net,并且只能读取EXIF数据,因此我只能为您提供一个起点.在C#中,如果您使用以下命令在System.Drawing.Image实例中打开文件:

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");

您可以使用image.GetPropertyItem(0x0112)访问原始EXIF数据,其中列出了所有可用属性项的列表:

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/zh-cn/library/ms534418%28VS.85%29.aspx

同样,有一个image.SetPropertyItem(0x0112)方法,但是我认为这只会在内存中设置它,并且您必须保存图像的副本才能写出来.我认为您想要的是在不触摸实际图像的情况下修改EXIF的能力,而我不知道该怎么做.

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.

正如我在评论中所说,我建议不要创建包含此类信息的Media类,而不是编辑图像标题信息:

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; }
}

然后,您可以将此记录存储在数据库中,这使搜索变得非常容易.如果需要实际文件,请使用PathToFile属性找到它.

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.

这篇关于如何编辑JPG文件标题,主题,注释和标签/关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 06:29