项目:
我正在建立个人使用的应用重新命名,重新编辑和组织我个人网站上托管的图像的启示数量。由于我一直在收集有趣的图片等几年,文件命名约定没有真正的韵律或理由。 Ergo,Image0001.jpg需要重新命名为描述性文件名,并且需要填写元数据字段。
所需的过程将采用现有的jpg ,gif,png,tiff或bmp,然后执行以下操作:
示例:
问题:
到目前为止,几天的研究几乎没有取得可测量的进展。信息显然已经被一些意想不到的搜索关键词所掩盖,这些关键词我还没有用于搜索。任何帮助将不胜感激。
当前代码是:
Imports System.IO 导入System.IO.Path 导入System.Drawing.Imaging 导入ImageData'(下面的自定义结构)'' * 公共结构ImageData 共享FileAuthorAuthor作为字符串共享FileAuthorCategory作为字符串共享FileAuthorComments作为字符串共享FileAuthorCompany作为字符串共享FileAuthorDateCreated作为DateTime 共享FileAuthorDescription作为字符串共享FileAuthorHeight作为十进制共享FileAuthorHeightResolution作为十进制共享FileAuthorImage作为图像共享FileAuthorKeywords作为字符串共享FileAuthorName作为字符串共享FileAuthorPath作为字符串'URL或IRL'共享Fil eAuthorRead As布尔共享FileAuthorSubject作为字符串共享FileAuthorTitle作为字符串共享FileAuthorType作为字符串共享FileAuthorWidth作为十进制共享FileAuthorWidthResolution作为十进制 End Structure' ImageData目前找到资料的方法是:
共享函数ReadExistingData(ByRef FileWithPath As String)As Boolean 提取文件名' Dim PathParts As String()= FileWithPath ()) Dim FileName As String = PathParts(PathParts.Length - 1) Dim FileParts As String()= FileName.Split(。) Dim FileType As String = FileParts(FileParts.Length - 1) '创建一个Image对象。 ' Dim SelectedImage As Bitmap = New Bitmap(FileWithPath) '从图像获取文件信息' Dim ImageFileInfo As New FileInfo(FileWithPath) Dim dso As DSOFile.OleDocumentProperties dso = New DSOFile.OleDocumentProperties dso.Open(FileWithPath.Trim,True,DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess) ImageData.FileAuthor = dso.SummaryProperties .Author'*需要dso.DLL' ImageData.FileCategory = dso.SummaryProperties.Category'*需要dso.DLL' ImageData.FileComments = dso.SummaryProperties.Comments'*需要dso.DLL' ImageData.FileCompany = dso.SummaryProperties.Company'*需要dso.DLL' ImageData.FileDateCreated = ImageFileInfo.CreationTime ImageData.FileDescription = dso.SummaryProperties.Comments'*需要dso.DLL。 ' ImageData.FileHeight = SelectedIm age.Height ImageData.FileHeightResolution = SelectedImage.VerticalResolution ImageData.FileImage =新位图(FileWithPath) ImageData.FileKeywords = dso.SummaryProperties.Keywords'*需要dso.DLL' ImageData.FileName = FileName ImageData.FilePath = FileWithPath ImageData.FileRead = ImageFileInfo.IsReadOnly ImageData.FileSubject = dso.SummaryProperties.Subject'*需要dso.DLL' ImageData.FileTitle = dso.SummaryProperties.Title'*需要dso.DLL' ImageData.FileType = FileType ImageData.FileWidth = SelectedImage.Width ImageData.FileWidthResolution = SelectedImage.HorizontalResolution 返回True End Function'ReadExistingData'<
-
dso。 DLL:非常有帮助,b不希望的。需要外部DLL。 [http://www.developerfusion/code/5093/retrieving-the-summary-properties-of-a-file/
-
不完整的数据〜不回答我的问题 [http://] msdn.microsoft/en-us/library/xddt0dz7.aspx
-
需要外部DLL [http://] www.codeproject/KB/GDI-plus/ImageInfo.aspx
-
所需的外部软件 [http://] stackoverflow/questions/3313474/write-metadata-to-png-image-in-net <旧数据〜Visual Studio 2005和.NET 2.0 [http://] www.codeproject/KB/graphics/
MetaDataAccess.aspx
我使用一个名为ExifWorks的类,在这里找到: www.codeproject/KB/vb/exif_reader.aspx?msg= 1813077 它的用法很简单,
Dim EX As New ExifWorks(bitmap) Dim dateStr As String = EX.DateTimeOriginal Dim description As String = EX.Description EX.SetPropertyString(ExifWorks.TagNames.ImageDescription,my description)这是迄今为止我找到的最简单的方法。如果遇到任何问题,请告诉我。
Clarifiration:
How do I Edit and Save Image EXIF / Metadata / FileInfo without using an external DLL?
Project:
I'm building an app for personal use to rename, retag, and organize the apocalyptic quantity of images I host on my personal website. As I have been collecting funny pictures and such for several years, there is no real rhyme or reason to the file naming conventions. Ergo, Image0001.jpg needs to be renamed to a descriptive filename, and the Metadata fields need to be filled in.
The desired process will take an existing jpg, gif, png, tiff or bmp and do the following:
Example:
(Later, I will also be using SQL to build a referential database with links to the online copies of these files to allow for searching by keywords, subject, filename, etc, but that's another layer that's much easier than this one. At least to me.)
Problem:
So far, several days of research have yielded almost no measurable progress. Information has apparently been inexplicably hidden behind a bunch of unexpected search keywords that I have not though to use for my searches. Any help would be appreciated.
Current Code as is:
Imports System.IO Imports System.IO.Path Imports System.Drawing.Imaging Imports ImageData '(The Custom Structure below)' '*Also has a project level reference to the dso.dll referenced below.' Public Structure ImageData Shared FileAuthorAuthor As String Shared FileAuthorCategory As String Shared FileAuthorComments As String Shared FileAuthorCompany As String Shared FileAuthorDateCreated As DateTime Shared FileAuthorDescription As String Shared FileAuthorHeight As Decimal Shared FileAuthorHeightResolution As Decimal Shared FileAuthorImage As Image Shared FileAuthorKeywords As String Shared FileAuthorName As String Shared FileAuthorPath As String 'URL or IRL' Shared FileAuthorRead As Boolean Shared FileAuthorSubject As String Shared FileAuthorTitle As String Shared FileAuthorType As String Shared FileAuthorWidth As Decimal Shared FileAuthorWidthResolution As Decimal End Structure 'ImageDataAnd the current method for finding the data is:
Shared Function ReadExistingData(ByRef FileWithPath As String) As Boolean 'Extract the FileName' Dim PathParts As String() = FileWithPath.Split("\") '" Dim FileName As String = PathParts(PathParts.Length - 1) Dim FileParts As String() = FileName.Split(".") Dim FileType As String = FileParts(FileParts.Length - 1) 'Create an Image object. ' Dim SelectedImage As Bitmap = New Bitmap(FileWithPath) 'Get the File Info from the Image.' Dim ImageFileInfo As New FileInfo(FileWithPath) Dim dso As DSOFile.OleDocumentProperties dso = New DSOFile.OleDocumentProperties dso.Open(FileWithPath.Trim, True, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess) ImageData.FileAuthor = dso.SummaryProperties.Author '* Requires dso.DLL' ImageData.FileCategory = dso.SummaryProperties.Category '* Requires dso.DLL' ImageData.FileComments = dso.SummaryProperties.Comments '* Requires dso.DLL' ImageData.FileCompany = dso.SummaryProperties.Company '* Requires dso.DLL' ImageData.FileDateCreated = ImageFileInfo.CreationTime ImageData.FileDescription = dso.SummaryProperties.Comments '* Requires dso.DLL.' ImageData.FileHeight = SelectedImage.Height ImageData.FileHeightResolution = SelectedImage.VerticalResolution ImageData.FileImage = New Bitmap(FileWithPath) ImageData.FileKeywords = dso.SummaryProperties.Keywords '* Requires dso.DLL' ImageData.FileName = FileName ImageData.FilePath = FileWithPath ImageData.FileRead = ImageFileInfo.IsReadOnly ImageData.FileSubject = dso.SummaryProperties.Subject '* Requires dso.DLL' ImageData.FileTitle = dso.SummaryProperties.Title '* Requires dso.DLL' ImageData.FileType = FileType ImageData.FileWidth = SelectedImage.Width ImageData.FileWidthResolution = SelectedImage.HorizontalResolution Return True End Function 'ReadExistingData'Just a couple of the "Top Box" search hits I've reviewed:
The dso.DLL: Very Helpful, but undesirable. Requires external DLL. []www.developerfusion/code/5093/retrieving-the-summary-properties-of-a-file/
Incomplete Data ~ Does not answer my questions []msdn.microsoft/en-us/library/xddt0dz7.aspx
Requires external DLL []www.codeproject/KB/GDI-plus/ImageInfo.aspx
External Software required []stackoverflow/questions/3313474/write-metadata-to-png-image-in-net
Old Data ~ Visual Studio 2005 and .NET 2.0 []www.codeproject/KB/graphics/MetaDataAccess.aspx
Convert to BMP: Looks useful []www.freevbcode/ShowCode.Asp?ID=5799
EDIT: This isn't a dll library, you just copy the source code to your project and create a new instance of the object.
I use a class called ExifWorks, found here: www.codeproject/KB/vb/exif_reader.aspx?msg=1813077 It's usage is simple,
Dim EX As New ExifWorks(bitmap) Dim dateStr As String = EX.DateTimeOriginal Dim description As String = EX.Description EX.SetPropertyString(ExifWorks.TagNames.ImageDescription, "my description")This is the easiest way I've found so far. Let me know if you run into any problems.
更多推荐
VB.NET重命名文件和重新标记/编辑图像元数据/元标记
发布评论