从 .NET 中的 JPEG 读取 IPTC 字段时出错
在我尝试过的大约 1% 的 JPEG 上调用 BitmapMetadata.GetQuery("/app13/irb/8bimiptc/iptc") 时,出现以下异常。 可能是什么原因造成的?我可以采取什么措施来解决这个问题? (我尝试过谷歌搜索,但只能找到一个相关结果,提出了相同的问题,但没有答案。)
System.OverflowException:
The image data generated an overflow during processing. --->
System.Runtime.InteropServices.COMException (0x88982F05):
Exception from HRESULT: 0x88982F05
--- End of inner exception stack trace ---
at System.Windows.Media.Imaging.BitmapMetadata.GetQuery(String query)
at MyProject.ImageRecord..ctor(String file)
in C:\MyProject\ImageRecord.cs:line 93
The image data generated an overflow during processing.
编辑:
exiv2
工具报告:
Error: Invalid Photoshop IRB data size 6372
I get the following exception when calling BitmapMetadata.GetQuery("/app13/irb/8bimiptc/iptc") on about 1% of JPEGs I have tried this on. What could be causing this and what can I do to fix it? (I have tried Googling but I can only find one relevant result asking the same question but with no answer.)
System.OverflowException:
The image data generated an overflow during processing. --->
System.Runtime.InteropServices.COMException (0x88982F05):
Exception from HRESULT: 0x88982F05
--- End of inner exception stack trace ---
at System.Windows.Media.Imaging.BitmapMetadata.GetQuery(String query)
at MyProject.ImageRecord..ctor(String file)
in C:\MyProject\ImageRecord.cs:line 93
The image data generated an overflow during processing.
Edit:
The exiv2
tool reports:
Error: Invalid Photoshop IRB data size 6372
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的猜测是 Photoshop IRB 数据比标头指定的长度长。
至少这是我可以通过浏览 Exiv2 的源代码(第 107 行)来推断的:
http://dev.exiv2.org/repositories/entry/exiv2/trunk/src/jpgimage.cpp?rev=1146
但是我对c的理解不太好! :)
My guess is that the Photoshop IRB data is longer than the header specifies.
At least this is what I can deduct by skimming over the source of Exiv2 (line 107):
http://dev.exiv2.org/repositories/entry/exiv2/trunk/src/jpgimage.cpp?rev=1146
But my understanding of c is not that good! :)
错误 0x88982F05 只是 WIC 的常规值超出范围错误
因此您可以轻松处理。 此外,这可能不是 IPTC 查询字符串的唯一问题。 只需尝试像这样 {} catch {} 此部分即可实现优雅的失败转移
Error 0x88982F05 is only regular value-out-of-range error by WIC
Thus it can be easely handled by you. Also this might not be your only problem with IPTC query strings. Just try {} catch {} this section like this to graceful fallover
根据exiv2报告的信息,Photoshop IRB信息的大小与元数据的整体大小不一致。
如果您希望忽略这些消息,我会更具体地说明您捕获的异常类型——仅忽略或报告特定的 COM 异常。
那里有一些工具/资源:
Based on the information reported by exiv2, the size of the Photoshop IRB information is inconsistent with the overall size of the metadata.
If you wish to ignore the messages I would be more specific in the the type of exception you catch -- only ignore or report that particular COM Exception.
A couple of tools/resources out there: