[Approved] Thumbnails creation fails with "indexed pixel format" exception. (1 Viewer)

cul8er

Retired Team Member
  • Premium Supporter
  • August 31, 2006
    2,159
    2,679
    Home Country
    Sweden Sweden
    • Thread starter
    • Moderator
    • #11
    re: Thumbnails creation fails with "indexed pixel format" exception.

    Hi,

    From my perspective yes.

    cheers
    cul8er
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    re: Thumbnails creation fails with "indexed pixel format" exception.

    This definitely needs fixing, but I think we should take a slightly different approach. The only thing that needs to change is the target bitmap pixelformat. We can either fix that to 8-bit RGB (easier), or check for unsupported pixel formats and use 8bit RGB only for those.
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    re: Thumbnails creation fails with "indexed pixel format" exception.

    Can you please try this patch instead?

    Edit: corrected patch file.
     

    Attachments

    • Fix - Thumbnails creation fails with indexed pixel format exception.patch
      1 KB

    cul8er

    Retired Team Member
  • Premium Supporter
  • August 31, 2006
    2,159
    2,679
    Home Country
    Sweden Sweden
    • Thread starter
    • Moderator
    • #14
    re: Thumbnails creation fails with "indexed pixel format" exception.

    Hi,

    Thanks, have tested and it works on most images. One problem remains. And I cannot find a solution, perhaps you can.

    The Graphics.FromImage method throws an "A Graphics object cannot be created from an image that has an indexed pixel format." message when the image is;
    *Format1bppIndexed
    *Format4bppIndexed
    *Format8bppIndexed

    see this msdn page for more info.

    All other formats I have tested works.

    best regards
    cul8er
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    re: Thumbnails creation fails with "indexed pixel format" exception.

    I don't understand. Graphics.FromImage is never called on an image with any of those formats. If any of those formats is used in the original image the newly created one will use Format32bppRgb.

    Can you debug and verify that the pixel format is indeed Format32bppRgb?
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    re: Thumbnails creation fails with "indexed pixel format" exception.

    * bump *

    Any news on this one?
     

    cul8er

    Retired Team Member
  • Premium Supporter
  • August 31, 2006
    2,159
    2,679
    Home Country
    Sweden Sweden
    • Thread starter
    • Moderator
    • #17
    re: Thumbnails creation fails with "indexed pixel format" exception.

    Hi,

    The call chain is like this, starting with a user doing a album or artist scrape within the audioscrobbler plugin in MP configuration:
    MediaPortal.Music.Database.AudioscrobblerUtils.fetchWebImage
    MediaPortal.Music.Database.AudioscrobblerUtils.DownloadTempFile (downloads temp file)
    MediaPortal.Util.Picture.CreateThumbnail (creates a thumbnail from the tempfile)

    I have found some cases like with the artist Toto that the temp file being downloaded is in this strange format. Using your patch I get an error "A Generic error occurred in GDI+" on the line g.DrawImage(aDrawingImage, new Rectangle(0, 0, iWidth, iHeight)); in MediaPortal.Util.Picture.CreateThumbnail. On the other hand on this image my original patch does not work either...

    Have tried many different image formats and on these your patch work great. Maby this last thing is just an small obscure error affecting very small number of images?

    I attach the Toto image for you to test on.

    best regards
    cul8er
     

    Attachments

    • toto.jpg
      toto.jpg
      873.7 KB

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    re: Thumbnails creation fails with "indexed pixel format" exception.

    There is something terribly wrong with this image. In some applications it appears as a 24-bit color image while in others as 8-bit. Also if you look at Properties in windows explorer (at least on XP/W2k3) width and height is 0!

    Also note that this time it is a different error and it is quite possible that we may never be able to read that image properly.
     

    cul8er

    Retired Team Member
  • Premium Supporter
  • August 31, 2006
    2,159
    2,679
    Home Country
    Sweden Sweden
    • Thread starter
    • Moderator
    • #19
    re: Thumbnails creation fails with "indexed pixel format" exception.

    Hi,

    I agree. Perhaps the bigger issue is resolved with your patch and we can close this issue. Have found just a few more images that the MP audioscrobbler downloads (like for Ricky Martin) and have problem with.

    I attach the Ricky Martin image just in case.

    Thank you for your help!

    cheers
    cul8er
     

    Attachments

    • ricky martin.jpg
      ricky martin.jpg
      438.7 KB

    cul8er

    Retired Team Member
  • Premium Supporter
  • August 31, 2006
    2,159
    2,679
    Home Country
    Sweden Sweden
    • Thread starter
    • Moderator
    • #20
    re: Thumbnails creation fails with "indexed pixel format" exception.

    Hi arion_p,

    Should we close this issue or what do you think?

    cheers
    cul8er
     

    Users who are viewing this thread

    Top Bottom