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!)
LVL 1
TiCpuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Roshan DavisCommented:
These links will not extract thumbnails from .db file, but some thumnail viewers

http://www.codeproject.com/listctrl/ThumbsViewer.asp
http://www.codeproject.com/vcpp/gdiplus/GdiPThumbnailsViewer.asp

Rosh :)
TiCpuAuthor Commented:
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.
DanRollinsCommented:
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
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

DanRollinsCommented:
http://www.vbaccelerator.com/home/VB/Type_Libraries/IVBExtractImage/article.asp&e=7249

Shows a VB tool to extract a thumbnail using the IExtractImage interface.  I can't tell if this can use thumbs.db as a cache of some sort.

   IExtractImage Interface
   http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/iextractimage/iextractimage.asp

See "Extracting thumbnail previews" here:
         http://netez.com/2xExplorer/shellFAQ/bas_infos.html
It looks like maybe enough C++ code to get started.

=-=-=-=-=-=-
If you Use the VC++ ClassWizard to "Add from TypeLib..." and browse to WebVw.DLL, you can get wrappers for interfaces such as IExtractImage.  But I can't find a clean example of using them.

-- Dan

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TiCpuAuthor Commented:
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.
TiCpuAuthor Commented:
I'll do with that, on Google groups there are some starts in thumbs.db decoding.

Thanks for infos!
kipherCommented:
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?
PendanmagdiaspaCommented:
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).
CastorixCommented:
> 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)
bimmingerCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.