Vb.net写入标签的图像元数据。 [英] Vb.net writing to an images metadata for tags.
本文介绍了Vb.net写入标签的图像元数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在尝试使用ExifWorks写入图片关键字/标签。但它不会写,下面是我的代码,我不确定是什么问题。
Hello, i'm trying to write to an images keywords/tags using ExifWorks. But it won't write, below is my code and i'm not sure what's wrong.
Public Class EXIFtest
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim text2 As String = TextBox2.Text
Dim text3 As String = Replace(text2, ".jpg", "")
Dim ef As New ExifWorks(text2)
Dim imgWithExif As Image = ef._Image
ef.Keyword = TextBox1.Text
imgWithExif.Save(text3 + "TAGGED.jpg")
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
TextBox2.Text = ("C:\Users\Simon\Music\Pictures\Exif Tests\DSC_1847.jpg")
PictureBox2.ImageLocation = TextBox2.Text
End Sub
Private Sub EXIFtest_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
TextBox2.Text = PictureBox2.ImageLocation
End Sub
End Class
是主程序
我已经添加到下面的ExifWorks
Is the main program
I've added to ExifWorks the below
Public Property Keyword() As String
Get
Return Me.GetPropertyString(TagNames.Keyword)
End Get
Set(ByVal Value As String)
Try
Me.SetPropertyString(TagNames.Keyword, Value)
Catch ex As Exception
End Try
End Set
End Property
SB.Append("\n\tKeyword: " & Me.Keyword)
和
and
Public Enum TagNames As Integer
ExifIFD = &H8769
GpsIFD = &H8825
NewSubfileType = &HFE
SubfileType = &HFF
ImageWidth = &H100
ImageHeight = &H101
BitsPerSample = &H102
Compression = &H103
PhotometricInterp = &H106
ThreshHolding = &H107
CellWidth = &H108
CellHeight = &H109
FillOrder = &H10A
Keyword = &H9C9E
我正在尝试添加到image属性,标签。但它不起作用,任何建议
I'm trying to add to the image property, tags. But it isn't working, any suggestions
Imports Microsoft.ImageMetadata
Imports Microsoft.PhotoToolboxFoundation
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim text2 As String = TextBox2.Text
Try 'This seems to work. look at the image noted in img_path.
Dim img_path As String = "C:\Users\Simon\Music\Pictures\Exif Tests\DSC_1847.jpg"
Dim p As MetadataPolicy = (New MetadataPolicyManager()).loadPolicy("C:\Users\Simon\Documents\Visual Studio 2010\Projects\EXIFtest\EXIFtest\Microsoft.PhotoToolboxFoundation.ToolboxPolicy.xml")
Dim imgProxy As ImageFileProxy = New ImageFileProxy(img_path, p)
Dim desc As Object = imgProxy.Data(p.getTagIndex("Description"))
imgProxy.Data(p.getTagIndex("Description")) = "This is a test description for the jpg!"
TextBox1.Text = ("Description: " + desc.ToString())
imgProxy.commit()
Catch ex As Exception
MessageBox.Show(ex.Message, ErrorToString)
End Try
End Sub
我的尝试:
我尝试将十六进制和标识符添加到原始类中。
What I have tried:
I've tried adding the hex and identifiers to the original class.
推荐答案
VB.NET从图像中检索元标记 - 堆栈溢出 [ ^ ]
解释得非常漂亮,我最初使用ExifWorks的想法是正确的。
谢谢谢谢谢谢谢谢我帮我找到了正确的问题。 :)
VB.NET Retrieving Meta Tags from an Image - Stack Overflow[^]
Explained it beautifully and my original idea of using ExifWorks was along the right lines.
Thank you Sergey for helping me find the right question i'm trying to ask. :)
请参阅此CodeProject文章: ExifLibrary for .NET [ ^ ]。
-SA
Please see this CodeProject article: ExifLibrary for .NET[^].
—SA
我从你的源代码下载的图像让我感到有些惊讶。请参阅我对解决方案1的评论。
这是另一个建议:请参阅这个带有Exif,IPTC,XMP和ICC支持的开源库: GitHub - drewnoakes / metadata-extractor-dotnet:从图像和电影文件中提取Exif,IPTC,XMP,ICC和其他元数据 。
-SA
The image I downloaded from your source surprised me a bit. Please see my comment to the Solution 1.
This is another suggestion: please see this open-source library with Exif, IPTC, XMP, and ICC support: GitHub — drewnoakes/metadata-extractor-dotnet: Extracts Exif, IPTC, XMP, ICC and other metadata from image and movie files.
—SA
这篇关于Vb.net写入标签的图像元数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文