Link to home
Start Free TrialLog in
Avatar of TiCpu
TiCpuFlag for United States of America

asked on

Extract thumbnails from thumbs.db

I know this question has already been asked and never answered, but I'm trying again in case someone who is new in EE knows the answer, do anyone knows how to extract images from thumbs.db file (not generating new ones, extracting them from the file itself) and if possible using C++ / MFC ? (any kind of answer will do if it works!)
SOLUTION
Avatar of Roshan Davis
Roshan Davis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TiCpu

ASKER

Not exactly what I wanted, it looks like it will do the same as other question about this file, let's be more specific: if I was only having this file and wanted to extract images from it, how could I do ?
This way it would be much more faster to see content of a remote folder than downloading each images to thumbnail them or looking at them using remote UPC path (\\computer\folder) and setting it to thumbnail, I don't know why it's so slow to see them this way.
Avatar of DanRollins
From a googlegroups thread:
http://groups.google.com/groups?&selm=3e653daf%241_7%40news.meganetnews.com

      Thumbs.db is  astructured storage with an index stream named "Catalog" and numbered
      streams containing the thumbnails. This is on Windows XP. Win2K stores the data using
      NTFS native streams, instead of a thumbs.db file.

     You can extract thumbnails by calling IShellFolder::GetUIObjectOf to obtain an
     IExtractImage interface for each item you're interested in. But unfortunately you don't
     get a free ride on the shell's thumbnail cache.

=-=-=-=-=-=-
Another hit idnicated that the aske found what looked like valid JPG files but missing critical grayscale tables (presumably held internally in the activeX control that uses these proprietary .DB files)

An old MSDN article says that you can use an ActiveX object named ThumbCtrl -- I found it in the VC++ list, but the ClassWizard was not able to create a wrapper for it.
=-=-=-=-=-
some related info:
     Windows Explorer No Longer Displays Web View Templates or
     HTML Customizations (Using Folder.htt)
     http://support.microsoft.com/default.aspx?scid=kb;en-us;819028
The link list at the bottom hase background info and info about ImageExtractors, etc.

Looking at folder.htt, the classID of the Thumbnail object seems to be:
    1D2B4F40-1F10-11D1-9E88-00C04FDCAB92

=--==-=-=-=-=-=-=-=-=-
Another thread said to try SHGetFileInfo, but that did not get the thumbnail when I tried it various ways.

-- Dan
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TiCpu

ASKER

Thanks for answer, so there aren't any valid ways to extract them directly from thumbs.db, it is only possible to create them from original document.. I let this question open 1 or 2 more days to be sure, if it isn't possible at all, DanRollins will have the points.
Avatar of TiCpu

ASKER

I'll do with that, on Google groups there are some starts in thumbs.db decoding.

Thanks for infos!
Avatar of kipher
kipher

Thumbs.db is a OLE Storage object. It follows a OLE storage specification to store jpegs in a RGB format however it misses some information, so extracting individual jpegs would not solve the problem cause there is no viewer that can understand this format.
So the only way i found to view the thumbs without having the originals is to "trick" Windows, so that it "thinks" that there is no need to refresh thumbs.db when you open a dir.
Once I programmed a perl script that could do this. It read the names and number of files (this information is at the CATALOG block of the OLE) in thumbs.db and create template files in a chosen dir. So Windows create thumbs.db of this dir. And so the perl script copies the jpegs codes from the original thumbs.db to the newly created. When you open that dir again Windows thinks theres no need to refresh and show you the thumbs you wanna see instead of the template thumbs. Got it?
This app will display the images in a bare Thumbs.db file, i.e. in the absence of the original images:
   http://www.itsamples.com/software/tdv.html
However, it does not provide for extracting the thumbnails into individual files. Still, all you need is the app and a Thumbs.db file (perhaps copied over the network) to see the images (it worked fine on a couple of smaller sized Thumbs.db files, ~70 & ~700 K, but crashed on a larger one, ~7000 K).
> so there aren't any valid ways to extract them directly from thumbs.db

Of course there is, simply with StgOpenStorage(), ::OpenStream(), etc.
Classic code (C)
I am also looking for how to read the thumbs out of thumb.db, but with another difficulty: I am using Java in my project; and the C# classes to read the OLE file format are not available for Java...

What I found is C# source code how to read the thumbnails from thumbs.db - this may help you (In the sourcecode section, full C# source is available):

http://www.itsamples.com/software/tdv.html