Threaded thumbnails demo

Yet another thumbnails demo, this time showing how to make the thumbnails in a seperate thread. There is a small problem which I belive is caused by the Delphi jpeg unit which sometime will render a thumbnail empty. With empty I mean that it has the correct width and height but not the image itself but just a white rectangle. If you figure out how to fix it please tell me so I can fix it. It only happens once and awhile so it is not easy to pinpoint what is causing it.

This demo also fix some problems which was present in previus thumbnail demos so if you had problems with previus demos try this one.

Using a diffrent imagelib seems to solve the problem reagarding blank thumbnail. I strongly recomend ImageEn but also GraphicsEx is a good one.

You need rkView installed to run this demo. You find it under components.

Download project with source

Added 01.dec.2009:
The same demo using ImageEnIO for loading and making the thumbs. You need to have ImageEn installed to compile and run this demo.

Download project with source (21 kB)
Download compiled demo (1008 kB)

Tags: , ,

  • andrefm

    Hi Roy,
    I compiled and tested with D2010 and everything worked fine. Maybe is something related to JPG pictures that you are using? It happened randomly (always different pictures)?
    Do you have the example that used ImageEn? I have ImageEn 3.0.5 and would like to see here if there is some performance improvement.
    Compared with the thumb browser from ImageEn, your read all images at once. Its good, but consume lot of memory in case that you have a directory with many images.
    But I really like you thumb browser, it's very clean and fast.
    I bought the thumb browser from http://www.nwscomps.com/tb.html but is not working in my pc with d2010. The developer is looking at it at moment.
    Thank you for share. Really well done

  • admin

    Thank you for your comments. Yes it is a bit strange since it was only one image (diffrent each time) that was cleared and only some times not always. Good to hear it is working well in D2010 I am still on D2007. Regarding memory usage … I was considering using a buffer but since the thumbs is stored as jpeg in memory it is ok … reducing the jpeg quality based on number of images could be one way to save memory. Personaly I like holding all thumbs in memory.
    Regarding ImageEn demo I see what I can do. Will probably post a demo in the weekend at least that is my plan.
    I did take a look at the thumb browser you was talking about, looks nice. Always nice to see others ideas. Hope they can fix it. Keep an eye for ImageEn demo here, maybe it can help.

    Roy

  • Alexander

    Hi,
    I just came across your beautiful components. Very nice work. as with the Jpeg, I sometimes received the error #54. To check wether your jpeg's are valid for Delphi run this code:

    function IsJPEGOk(const Filename: TFilename): BOOLEAN;
    var
    FileStream: TFileStream;
    w1 : WORD; // a “word” is always 2 bytes long
    w2 : WORD;
    begin
    assert(SizeOf(WORD) = 2);
    result := FileExists(Filename);
    if result then
    begin
    FileStream := TFileStream.Create(Filename, fmOpenRead OR fmShareDenyNone);
    try
    FileStream.Seek(0, soFromBeginning); // use seek or position
    FileStream.Read(w1,2);
    FileStream.Position := FileStream.Size – 2;
    FileStream.Read(w2,2)
    finally
    FileStream.Free
    end;
    result := (w1 = $D8FF) AND (w2 = $D9FF);
    end;
    end;

  • http://pulse.yahoo.com/_KNQHTID7DHK4MX3YYSPWMSYEEM OJr

    This version of your list of thumbs is very interesting, This is similar to Windows XP for example. I didn’t know that it is threaded thumbnails. I noted you also have improved some things in this version. For example, in this version the software load just the images in the directory selected (root). But… look below:
    —————————
    Demothumbs
    —————————
    Out of system resources.
    —————————
    OK
    —————————
    It was a big error when I was running your demo. The bug occurred infinitely! It happen if you have some problematic image In the directory.
    I imagine this kind of software is really complicated…

blog comments powered by Disqus