Test application: For "lightning fast thumbnail creation" (2 Viewers)

lkuech

Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    Hi all.

    Short description:
    I have developed a small test application based on my EXIF information extraction routine. Please test it with your pictures and tell me if it works.

    to test it simply use the "..."-button and browse to a folder that contains images of your digital camera (JPG). Press the start button and watch the show ;)
    (subfolders are not included)

    For me it takes <20 seconds to "create" thumbs of 1573 images (we talking about 2,86GB of pictures!)


    Longer story
    One thing I "hat" from my early beginning of using MediaPortal is the very slow creation of thumbnail. This is especially a problem if you want to browse pictures from a memorystick or a network share and the thumbs for that pictures hat not been created before.
    I always though why is MP so slow while other applications like the Ms MediaCenter or picture manager like Cam2PC and ACDSee or so impressive fast (at least if we talk about pictures from digital cameras).

    After some research I found out that the other applications no not really create the thumbnails... they simply use the thumbs that are already embedded in the jpg's EXIF information.

    Of course these embedded thumbnails are not as good as the one MP is creating on the highest level and we are not able to replace the creation of large thumbs either, but the embedded thumbs are good enough to compare them to the medium quality settings of MP.

    My idea is to create a option to disable the auto creation of MP completely and
    use my routine to simply show the embedded thumbs.
    So the behaviour of MP would be:
    • Looking into the "\thumbs\pictures\" folder if a "highres" thumb is available
    • if not use the embedded thumb
    • if there is no embedded thumb... there could be an option to create a thumb in the "\thumbs\pictures\" folder.

    If the user would like to use highres thumbs he can use the manual thumbs creation. This also helps to avoid the waste of diskspace because you theoretically need only thumbnails in your "\thumbs\pictures\" folder of pictures that don have thumbnails embedded.

    BTW: the speed is also impressive if the images are stored on a compact flashcard or a networkshare via wireless lan, because the images are not read completely (like the most examples of exif extractors did that). My routine read and analyses the heady information of the images and stops as soon as the informations is found or not...

    Bye
    Lars

    EDIT: If you are interested how this may look like in MediaPortal you should look at the following post: https://forum.team-mediaportal.com/showpost.php?p=169717&postcount=13
     

    The_Stig

    Retired Team Member
  • Premium Supporter
  • April 5, 2005
    2,176
    428
    Great one! Will test and report later!

    EDIT:

    Works fast and good for me. How about joining on IRC and talk how to integrate this to MP directly?
     

    Inker

    Retired Team Member
  • Premium Supporter
  • December 6, 2004
    2,055
    318
    That's very impressive lkuech. I can confirm it works very fast even in a directory with lots of 5 mb+ images. It's almost scary, lol.

    I also agree with your behaviour suggestion. One question, how big a resolutions do these thumbnails have (I didn't even know thumbnails were in exif)?

    Would love to see this in MP.
     

    lkuech

    Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    Well. The size seems to vary depending on the camera that has taken the picture. But if I remember correctly they are 160x 120 in most cases.

    The_Stig: Regarding join the IRC. I just registered my Nick at the webIRC (start page)... so we will met us there ;)


    Edit:
    Mhh. I would love to get a little bit more feedback on this before thinking of an integration. It looks like the thread doesn't get much attention here...

    But anyway. I will try to start an experimental integration of the routine next week (hopefully). Then we will see how easy the integration is or if I need some help by a more experienced developer. :D

    Bye
    Lars
     

    Maschine

    Retired Team Member
  • Premium Supporter
  • June 15, 2004
    768
    86
    Germany
    Home Country
    Germany Germany
    Indeed VERY fast ;) Tried it on some folders and the result was great!

    Just out of interest: do you know what happens if you edit the original file (like red eye removal, cropping etc.), does the exif thumbnails gets recreated then? Or can it only be added by the camera so that we'll still see the original pic in the thumbnail?

    Would be nice to see this icluded in MP :)

    Maschine
     

    The_Stig

    Retired Team Member
  • Premium Supporter
  • April 5, 2005
    2,176
    428
    The missing attention is most likely due to the fact that not much ppl watch the cpu load at a normal htpc-usage. But if you have once seen how much cpu-load it consumes to create thumbs on pictures folders, you will love a better function here.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Indeed VERY fast ;) Tried it on some folders and the result was great!

    Just out of interest: do you know what happens if you edit the original file (like red eye removal, cropping etc.), does the exif thumbnails gets recreated then? Or can it only be added by the camera so that we'll still see the original pic in the thumbnail?

    Depends on the software that is used for editing the image. Not all of those are able to update the exif thumbnail.
     

    Jack Sparrow

    Portal Member
    December 28, 2006
    35
    0
    Home Country
    Italy Italy
    The missing attention is most likely due to the fact that not much ppl watch the cpu load at a normal htpc-usage. But if you have once seen how much cpu-load it consumes to create thumbs on pictures folders, you will love a better function here.

    Mybe I do not look at CPU usage ... but of course I saw that MP is very slow in creating thumb ;)

    I will test it and post reports asap

    Anyway ... good job @lkuech
     

    lkuech

    Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    I just took a brief look at the source code of MyPicture section of MP.

    It seams that the integration becomes more complicated as I thought.

    From my brief research I did not found a method that allows me to set the shown Thumb in the facadeView at runtime without loading a file from disk. All available methods seem to based on loading files (thumbs) from the harddrive, but that (of course) will slow down the whole routine because I have to save the thumb just to load it afterwards.

    I've found the implementation of the OnRetrieveCoverArt. At this point it would easy to "turn to" my ExifExtractor to check if the item has an embedded and retrieve it. But how can I assign the retrieved image the the facadeView?

    I tried something like this for testing (in the OnRetrieveCoverArt):
    Code:
    Bitmap tmpBitmap = new Bitmap(160, 120);
    Graphics tmpGraphics = Graphics.FromImage(tmpBitmap);
    tmpGraphics.FillEllipse(Brushes.Red,new Rectangle( 0, 0, 160, 120));
    
    System.Drawing.Image img = (Image)tmpBitmap.Clone();
    
    item.Thumbnail.MemoryImage = img;
    But item.Thumbnail is always null. And create new GUIImage seems to need a filename again ... :(

    The following code does work (Of course)... but this no solution.
    Code:
    Bitmap tmpBitmap = new Bitmap(160, 120);
    Graphics tmpGraphics = Graphics.FromImage(tmpBitmap);
    tmpGraphics.FillEllipse(Brushes.Red,new Rectangle( 0, 0, 160, 120));
    
    System.Drawing.Image img = (Image)tmpBitmap.Clone();
    img.Save("C:\\test.jpg", ImageFormat.Jpeg);
    
    string thumbnailImage = "C:\\test.jpg";
    item.ThumbnailImage = thumbnailImage;

    Any ideas?

    Bye
    Lars
     

    idioteque

    Retired Team Member
  • Premium Supporter
  • September 29, 2005
    609
    9
    Home Country
    Netherlands Netherlands
    for me it works only if I specify a folder with jpg inside of it.

    If I specify the folder above that, eg multiple folders the program just sits their doing nothing after i press start
     

    Users who are viewing this thread

    Top Bottom