views:

439

answers:

4

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
+1  A: 

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

Marc
Thanks, I wonder if there are any tools for correcting such errors in the headers?
Liam
A: 

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 {}
Tamir
A: 

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:

dpp