locked
Loading jpeg with tags problem

    Question

  • I encountered an error "0x88982f8e: The bitmap property type is unexpected." when loading jpeg file using CreateDecoderFromFilename. It turned out that this file has a lot of tags. Is there a way around this problem?
    Wednesday, April 2, 2014 9:43 AM

Answers

  • There's a ton of information about how to modify image tags programmatically, but I don't have any Store-specific samples for this.  I suggest that you find one the code samples on the internet and port it.  If you have a specific issue when trying to port it, just ask a question about it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, April 4, 2014 2:15 PM
    Moderator
  • This is is the image.

    Also i was wrong about IPTC tags. Still don't know wich specific tag, but it  located definetly in EXIF section.

    I found an utility which removes entire EXIF section and modified it into library. So problem is solved.

    Thanks to everyone.

    Monday, April 7, 2014 10:25 AM

All replies

  • Perhaps use a tag editor and determine which one/ones are causing the problem, remove them?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, April 2, 2014 1:30 PM
    Moderator
  • I found that this is Iptc tags. The problem is that I need to remove them programmaticaly. I would be grateful for any help.

    Thanks

    Thursday, April 3, 2014 5:11 PM
  • There's a ton of information about how to modify image tags programmatically, but I don't have any Store-specific samples for this.  I suggest that you find one the code samples on the internet and port it.  If you have a specific issue when trying to port it, just ask a question about it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, April 4, 2014 2:15 PM
    Moderator
  • Try with WICDecodeMetadataCacheOnDemand 
    Friday, April 4, 2014 4:26 PM
  • Can you share the specific file that is giving the failure?

    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.
    © Microsoft Corporation. All rights reserved.

    Friday, April 4, 2014 10:23 PM
  • This is is the image.

    Also i was wrong about IPTC tags. Still don't know wich specific tag, but it  located definetly in EXIF section.

    I found an utility which removes entire EXIF section and modified it into library. So problem is solved.

    Thanks to everyone.

    Monday, April 7, 2014 10:25 AM
  • Can you post the original JPG on a file share somewhere? It would be useful to pass along to the WIC team to make sure they handle the mystery tag... or determine the EXIF section is corrupted.
    Monday, April 7, 2014 6:05 PM
  • Hello,

    The metadata in this image does appear to be corrupted. You can see how WIC loads the image's metadata using the WICExplorer tool:

    http://archive.msdn.microsoft.com/wictools

    WIC Explorer reports an error when trying to extract the EXIF metadata block.

    You can also try using a third party tool like ExifTool:

    http://www.sno.phy.queensu.ca/~phil/exiftool/

    ExifTool ignores the malformed metadata and reports no EXIF information.

    In general, there is a class of errors reported by WIC that indicate the file is corrupted or otherwise unloadable. WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE is one of these errors. If your application is attempting to read/use the file's metadata, it should handle these errors and degrade gracefully; for example, you can skip metadata parsing if it fails.

    In your case, you mention that you are simply trying to load the image into a decoder using CreateDecoderFromFilename(). Make sure that you are passing in WICDecodeMetadataCacheOnDemand:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ee719824(v=vs.85).aspx

    This instructs WIC to defer parsing non-critical metadata until you explicitly request it (e.g. by getting an IWICMetadataQueryReader). If you pass in WICDecodeMetadataCacheOnLoad, WIC will load - and critically, validate - the image's metadata immediately, which results in the operation failing.


    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.
    © Microsoft Corporation. All rights reserved.

    Monday, April 7, 2014 8:29 PM