Error reading IPTC fields from JPEGs in .NET

1

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
exception
.net-3.5
jpeg
iptc
asked on Stack Overflow May 18, 2009 by Liam • edited May 27, 2009 by Liam

3 Answers

1

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! :)

answered on Stack Overflow May 28, 2009 by Marc • edited Jun 20, 2020 by Community
1

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

if (bitmapMetadata.GetQuery(MY_QUERY) != null &&) {
try { 
... }
catch {}
answered on Stack Overflow Jun 1, 2009 by Tamir
0

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:

answered on Stack Overflow Jun 1, 2009 by denis phillips

User contributions licensed under CC BY-SA 3.0