【发布时间】:2014-06-20 04:04:40
【问题描述】:
我正在尝试使用 Magick.NET 库的this example 从图像中读取 Exif 信息,但在我尝试迭代 Exif 值的那一刻,我得到一个未处理的错误:
“System.ArgumentException”类型的未处理异常发生在 Magick.NET-AnyCPU.dll
附加信息:La matriz de origen no es suficientemente 拉加。 Compruebe srcIndex, la longitud y los límites loweres de la 矩阵。
(英文:source Array不够长。检查srcIndex, 数组的长度和下界)
这是我正在使用的代码:
Using img As New MagickImage("C:\Jpeg With Exif.jpg")
' Retrieve the Exif Information (if any)
Dim ExifData As ExifProfile = img.GetExifProfile()
' This instruction throws the same unhandled exception that the 'For' below.
' MsgBox(ExifData.Values.Count)
Select Case ExifData Is Nothing
Case True ' Zero Exif values found.
MessageBox.Show("The image does not contains Exif information", "Image Information",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Case Else ' At least 1 Exif value found.
' StringBuilder to format the Exif entries.
Dim sb As New System.Text.StringBuilder
' Iterate the Exif values.
For Each Value As ExifValue In ExifData.Values
' ******
' Here throws the unhandled exception.
' Even if the For block is empty of instructions.
' ******
With sb
.AppendLine(String.Format("{0}({1}): {2}",
Value.Tag,
Value.DataType,
Value.ToString()))
End With '/ sb
Next Value
MessageBox.Show(sb.ToString, "Exif Image Information",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Select '/ ExifData Is Nothing
End Using '/ img As New MagickImage
那么这是一个错误,还是我做错了什么?
注意:我之前使用此命令在ExifTool 程序中添加了Exif 信息:
.\exiftool.exe -artist="value" "c:\Test.jpg"
这是我尝试检查的图像: http://www.mediafire.com/?42kvy8hhu4mgpz7
【问题讨论】:
-
您使用的是最新版本吗?你能发布一个指向你的图像文件的链接吗?
-
是的,我正在使用最新版本,这是我第一次使用这个库,我需要说我面临着与另一个学习如何创建缩略图的示例相同的未处理异常的 Exif,我正在使用的图像可以在这里下载:i.imgur.com/mG0IA6R.jpg(它包含“作者”和“版权”exif 值),感谢您的评论!
-
您下次也可以在这里提出与 Magick.NET 相关的问题:magick.codeplex.com/discussions。这比在 cmets 中提问更容易。您可以将图像发布到Dropbox之类的东西上吗? imgur 似乎删除了元数据。
-
@dlemstra 这是正确的图片:mediafire.com/?42kvy8hhu4mgpz7 PS:我很欣赏你的建议,但我从来没有在 codeplex 中获得帮助
标签: .net vb.net image imagemagick exif