Sunday, June 29, 2008

Windows Media Center not recognizing and not displaying jpg images - showing "unable to display picture" error

Last week I tried to view on my TV a couple of pictures recently snapped using an XBox 360 as a Media Center Extender connected to my Vista PC. As much as I tried, I could not convince the Media Center to display the pictures - it was simply not recognizing them. Here are the symptoms I was experiencing:

1) adding the folder containing the pictures to the Media Center Library (using WMC interface) was recognizing the number of files, but when to display the pictures in that folder, it was showing "0 pictures". I tried with folders placed in different locations (my account's Pictures folder, the Public Pictures folder, a network folder on my NAS box, etc) without any success.

2) adding the folder containing the pictures using Media Player's Library worked halfway. When the pictures were added from a NAS folder the pictures were added to the library, but Media Player was not able to show their mediathumbnails (for some reason, it was showing correctly the CR2 files, but not the JPG files).  Photo cameras write the images on memory cards,which are usually formatted as FAT, and the names are capitalized, like IMG_0001.JPG. I was copying the photos on my Infrant ReadyNAS 600 device which uses Linux/ext2 as the file system, which is case sensitive. When MediaPlayer was adding the images to its library, he was changing the case of the extension, and was adding the files as IMG_0001.jpg (This could be seen by looking at the Properties of the file in the library). Because the files were hosted on a case-sensitive Samba share on my NAS/Linux box, trying to view the file was displaying "File not found" errors. It believe this is a bug in MediaPlayer, so I reported it to Microsoft. Meanwhile, I looked at Infrant/Netgear ReadyNAS add-ons and I found ToggleCaseSensitivity that I used to switch the file system to be case-insensitive. After this, MediaPlayer showed correctly all the files in its library.

3) now back to MediaCenter. WMC reuses the MediaPlayer's library, thus it should have displayed the files I was able to see with MediaPlayer. However, that turned out not to work as expected. I tried to browse the library ByFolder, and I was navigating to the folders with pictures, but they only displayed "0 items". Trying to enter the folder showed "No pictures were found" message. I also tried to browse the library ByDate, navigate to the year and month when the pictures were taken. This had a bit more success in the sense that at least it displayed the file names. However, only placeholders were shown for all pictures, with just the picture names. Clicking on one of the files to show the picture caused Media Center to show a message "Unable to display the picture".wmc2wmc1

I searched the net and found that many other users had similar problems; there were references to the jpg file associations being messed up.

Indeed, in the registry the file associations for the jpg extension was looking like this:

   [HKEY_CLASSES_ROOT\.JPG]
@="JPG_auto_file"
"Content Type"="image/jpeg"


Comparing with the setting of another Vista machine, it turned out the important part missing that was causing MediaCenter to skip the files was a missing PerceivedType registry value, that should have been set to image. (The ContentType was also missing - I restored a couple of weeks ago, when I discovered without it Windows Live Writer has troubles with images - see previous posts). I was also missing the PersistentHandler setting; the  JPG_auto_file was written by IrfanView, which was associated with the jpg files. I don't know if IrfanView was responsible or not for the missing values...



Anyway, by default, the registry values should look like this:



   [HKEY_CLASSES_ROOT\.jpg]
@="jpegfile"
"Content Type"="image/jpeg"
"PerceivedType"="image"


wmc3I was missing similar keys for the  *.jpeg file association.



So I manually added the PerceivedType setting in registry and I've restarted MediaCenter; it immediately recognized the jpg pictures, and now everything looks good again!



If you want to restore the jpg/jpeg file associations to their default values, you can edit manually the registry or you can save the setting below to a file with *.reg extension, then double click the file in Explorer.



 





----------------------------------------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.jpg]
@="jpegfile"
"Content Type"="image/jpeg"
"PerceivedType"="image"

[HKEY_CLASSES_ROOT\.jpg\OpenWithProgids]
"jpegfile"=""
"WindowsLive.PhotoGallery.jpg.12.0"=""

[HKEY_CLASSES_ROOT\.jpg\PersistentHandler]
@="{098f2470-bae0-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\.jpeg]
@="jpegfile"
"Content Type"="image/jpeg"
"PerceivedType"="image"

[HKEY_CLASSES_ROOT\.jpeg\OpenWithProgids]
"jpegfile"=""
"WindowsLive.PhotoGallery.jpg.12.0"=""

[HKEY_CLASSES_ROOT\.jpeg\PersistentHandler]
@="{098f2470-bae0-11cd-b579-08002b30bfeb}"
----------------------------------------

4 comments:

Anonymous said...

Hi,
I have the same problem but with video files as avi, wmv...
Can you help me?
Thanks

Anonymous said...

in MS Registry Editor i have this:
HKEY_CLASSES_ROOT -> .avi
OpenWithProgIds
(default), REG_SZ, (value not set )
avifile, REG_NONE, (zero-length binary value)
WMP11.AssocFile.AVI, REG_NONE, (zero-length binary value)

PersistentHandler
(default), REG_SZ, {098f2470-bae0-11cd-b579-08002b30bfeb}

ShellEx
here some values like PersistentHandler...

Anonymous said...

deci, care este problema la mine pana la urma...
aseara, filmele avi ce le rulam cu WMP 11 ( DivX Codec ) aveau la thumb-uri un cadru din film... asa am avut si pana acuma... de aseara incoace, brusc... la fisierele AVI nu mai imi face thumb nici in Windows Explorer si nici in WMP 11 panelu din dreapta... le afiseaza pur si simplu cu thumbul din MS Windows Vista...

Ce pot sa fac, ce pot sa corectez?
Nu am System Restore activat si date despre o problema ca si asta nu am gasit pe siteurile Microsoft.

Sper sa ma ajuti, te rog? :-)

Alin Constantin said...

I'm not sure what the right settings should be for an avi or wmv file, but I'd try to look at the registry on a Vista machine where things are working fine.

On my machine, the settings are as follow:

----------------------------------------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.avi]
@="avifile"
"Content Type"="video/avi"
"PerceivedType"="video"

[HKEY_CLASSES_ROOT\.avi\OpenWithProgids]
"avifile"=""

[HKEY_CLASSES_ROOT\.avi\PersistentHandler]
@="{098f2470-bae0-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\.wmv]
@="WMVFile"
"Content Type"="video/x-ms-wmv"
"PerceivedType"="video"

[HKEY_CLASSES_ROOT\.wmv\OpenWithProgids]
"WMVFile "=""

[HKEY_CLASSES_ROOT\.wmv\PersistentHandler]
@="{098f2470-bae0-11cd-b579-08002b30bfeb}"
----------------------------------------