【问题标题】:Magick.NET is unable to read Exif tagsMagick.NET 无法读取 Exif 标签
【发布时间】: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


【解决方案1】:

您在 Magick.NET 中发现了一个错误。您的图像包含未正确检查的无效尺寸。这将在 Magick.NET 6.8.9.401 中修复。

正如 cmets 中还指出的,您还可以在此处报告问题/提出问题:https://magick.codeplex.com/discussions。我会回答那里提出的所有问题。

使用包含此问题修复程序的构建,我能够提取以下值:

XResolution: 1
YResolution: 1
ResolutionUnit: 1
Artist: Phil Harvey
YCbCrPositioning: 1
Copyright: 2011 Phil Harvey

【讨论】:

  • 对不起,我没有注意到你是 Magick.Net 的开发者!所以如果你建议我把我的问题贴在那里以获得你的支持,那么下次我会这样做,谢谢你的时间! PS:我想建议你为 codeplex 文档创建一个新的例子,当然只有你愿意,一个关于在 gif 中重新排序帧的例子,我对此很好奇!
猜你喜欢
  • 1970-01-01
  • 2012-08-10
  • 2021-06-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多