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
Liam
  • 19,819
  • 24
  • 83
  • 123
  • Could you post a JPEG that has this problem so that I can look into it? – Brian ONeil May 26 '09 at 15:52
  • Unfortunately I cannot post an example as some of the IPTC data is copyrighted, and if I edit it out then the exception will not reproduce. – Liam May 27 '09 at 09:49

3 Answers3

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

Community
  • 1
  • 1
Marc
  • 1,798
  • 8
  • 15
  • Thanks, I wonder if there are any tools for correcting such errors in the headers? – Liam May 29 '09 at 12:03
  • I came across this error again, Googled it, and found my old question here. This time around I added a try..catch block, logged the names of the problem files, and fixed them by opening them in XnView, and selecting Edit > Metadata > Edit IPTC data > Write . – Liam Oct 10 '12 at 11:29
  • Any suggestions for doing this for a large batch of images? – Liam Oct 10 '12 at 13:57
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 {}
Tamir
  • 2,503
  • 16
  • 23
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:

denis phillips
  • 12,550
  • 5
  • 33
  • 47