PNG images are not displayed when loaded from disk RRS feed

  • Question

  • I've created a news app which displays images directly from the web when an article is loaded for the first time. After that the content including images is saved on disk (in applicationData.localFolder) and loaded from there.

    The problem is that everything works perfectly fine except for PNG images. They are stored on disk (and can be shown using Windows Photo Viewer), but aren't displayed in my app as opposed to JPG and GIF images.

    Links to images are in the following form: ms-appdata:///local/16/15864/imageX.png

    Using the DOM explorer I was able to check that the src attribute of the img tag is correctly set, but both the width and height are equal to 0 in case of PNG images.

    Any idea what could be the problem? Do PNGs have to be treated differently than JPGs and GIFs?

    • Edited by metrostyle Friday, July 13, 2012 3:57 PM
    Friday, July 13, 2012 3:17 PM

All replies

  • If you copy the file: imageX.png to a simple blank application and add an <img> tag pointing to the image does it display?  If not, then there must be something wrong with the way the png is saved (and perhaps why the width and height are showing as 0).

    Jeff Sanders (MSFT)

    • Proposed as answer by Dino He Friday, July 20, 2012 10:12 AM
    Friday, July 13, 2012 6:17 PM
  • OK, I created a simple blank application and added one of the png images and then the image also isn't displayed. I find this quite strange as the png images are saved exactly the same way as jpg and gif images, whereas the latter are displayed correctly. Also in the simple blank application.

    Do you have an idea what could be wrong? If the png images are saved incorrectly, then my guess would be that Windows Photo Viewer shouldn't display them either, but this isn't the case.

    Saturday, July 14, 2012 12:51 PM
  • It could be that photoviewer is more forgiving of errors or formatting issues.

    Jeff Sanders (MSFT)

    Tuesday, July 17, 2012 6:09 PM