Return to Digital Photography Articles

How to Recreate THM Thumbnails from CRW / CR2

THM files are used to contain the writeable metadata for proprietary file formats such as Canon's RAW .CRW and .CR2. This page describes how one can repair or replace these thumbnail files.

I discovered that a number of my older RAW files were missing the associated THM file, which was immediately flagged by catalog program as soon as I tried to open up an IPTC editor window. Please read about THM files if you are not familiar with them.

The following describes the simple steps one can take to create these missing THM files.

Step 1 - Create JPEG Versions

If you have already created JPEG conversions of your RAW images, then you can skip ahead to the step 2.

Option A - Using BreezeBrowser to extract the JPEG Previews

BreezeBrowser provides a quick method to accomplish this step is to do the following:

  • Use Extract Embedded JPEGs. This will create JPEGs from the Canon RAW files (.CRW).
  • Select Store EXIF data in JPEG and make sure that Rotate JPEG if Required is not selected.

BreezeBrowser used to include a separate utility called Twiddle that performed the THM regeneration, but this utility has been phased out by the developer.

Option B - Using Adobe Photoshop to generate the JPEG files

This method simply uses Photoshop's Adobe Camera Raw (ACR) to create JPEG images from the RAW files. The following section describes these steps in simple details, processing all of your images at one go.

  • Open Adobe Bridge (go into Photoshop and select File -> Browse...)
  • Locate the root folder of interest
  • Find all Camera RAW files by Edit->Find...
  • Select all in the Find Results window
  • Right-click on one, selecting Open in Camera Raw...
  • Select all files (with the button) in ACR (Adobe Camera Raw). Click on the Save ## Images button
  • The Save Options dialog box is shown. Change Destination to Save in New Location, then click on Select Folder.... When prompted, navigate to the directory of your RAW files and create a subfolder (e.g. TempThumbs) for your thumbnails. Select this subfolder as the destination. For the rest of the Save Options dialog, you want to make sure that Format is set to JPEG and that the file naming is left as simply "Document Name". The File extension should be for a JPG file and the Quality level is not very important.

    Once you've selected all of the options as desired, click on Save, which brings you back to the ACR window and starts processing.
  • You'll see the current progress indicated above the Save ## Images button. Wait for it to complete before proceeding.

Step 2 - Create Reduced JPEG Versions

In this step, we're simply saving space by reducing the size of the actual image content within the THM files. While it's not totally necessary, these THM files only really need to have a small low-quality preview, as they are only used for EXIF / IPTC / Metadata containment, not image previews. The RAW image previews are extracted from an embedded JPEG image which is already inside the CRW or CR2 file itself. Most photo catalog programs won't even show the THM file contents, so it would be wasteful to consume several megabytes for this purposes.

Resizing Photos with IrfanView

IrfanView is easily one of the best free image manipulation programs out there that is well-designed for batch operation. I find it much easier to use in a multi-file operation than bigger editors, such as Photoshop. Plus, there are certain functions, such as the ability to resize dimensions to a given maximum without changing aspect ratio with no need to worry about orientation -- an operation that is much harder to automate within Photoshop.

  • Open IrfanView, select File -> Batch -> Conversion/Rename...
  • Navigate to your TempThumbs folder (where it says "Look in:")
  • Select all of the JPEG images in this directory and click on Add. Click on "Use this directory as output". Select "Batch conversion - Rename result files". Select "JPG - JPEG Format" in "Output format". Click on Use Advanced Options. Under Batch Rename Settings, enter "$N.THM" into the Name Pattern field. The resulting dialog box should look like the one shown below. Unfortunately, IrfanView doesn't allow us to rename the file extension to THM, so we'll have to leave this to step 3.
  • Click on Set advanced options. Click on the RESIZE checkbox. Select "Set both sides to" and fill in both the width and height to 160 and ensure pixels is selected. Select "Preserve aspect ratio" and "Save files with original date/time". The dialog box should appear as shown below. When complete, click on OK. The size 160 is chosen because the original THM dimensions are generally 160x120 pixels.
  • Click on Start, and IrfanView will begin processing your images, displaying a window showing each JPEG file conversion as they complete. For example, you might see: \TempThumbs\20040523_2016.JPG converted to \TempThumbs\20040523_2016.THM.jpg. You will now be left with a subdirectory full of .THM.jpg files. The next step simply renames and moves these files.

Step 3 - Create THM Thumbnails

Thankfully, the THM file format is basically identical to the JPEG file format, and so we can simply rename the small preview images to create the final THM files. There are many programs that will do this for you, some better than others. Of course you can also do this by hand if you don't have many to generate.

Renaming files with Flexible Renamer

Just recently I stumbled upon Flexible Renamer, and I think it appears to offer the best of everything for a free renaming utility. It has full regular-expression and pattern substitution capability (for advanced users) in addition to a simpler mode of operation for more casual users.

In Flexible Renamer, I would use the following steps:

  • Open up the utility and navigate to the TempThumbs folder
  • Click on Advanced Rename and then RegExp
  • In Search for: enter ".THM.jpg". In Replace with:, enter ".THM".
  • Verify that the listing in the right window looks correct and click on Rename

Renaming files with MRename

Another program that I previously used extensively was MRename. It, too, has full pattern-match and substring substitution (regex) capability and it installs a context menu into Windows XP Explorer. So, while it is one of the more powerful free renaming programs out there, it is only really suitable for advanced users who are familiar with regex.

  • Navigate to the TempThumbs folder in Windows XP. Select all and then right-click on one file, selecting "MRename" from the context menu.
  • In the MRename window that appears, enter "*1.jpg" into the Select: field and then "\1" into the Rename: field. Note that the default operation for MRename is to be case sensitive, so you may have to adjust accordingly. Once you've confirmed that the filenames listed under the heading New file name look right, click on Rename all

Step 4 - Relocate the new THM files

Now that you've created the THM files, you'll need to move them back into the same folder as the original RAW files. The THM buddy file system only works if the files have identical filenames (besides the extension) and in the same directory as the RAW files.

  • With all of the THM files still selected, Copy them, click on the folder up button (so that you are now in the folder with the original RAW files) and Paste. If any warning comes up saying "Confirm File Replace", click on "No", as it is best to use any original THM files that existed previously, rather than using the recreated ones.
  • You can now delete the TempThumbs directory and you're done!


Reader's Comments:

Please leave your comments or suggestions below!
 @roberto: use VirtualDub to copy (press Ctrl+1) one frame from the MPEG/AVI file into clipboard -> paste into any program that can save image as JPEG (and resize it) or make a selection from frame 1 to 2 (press "[", "right arrow", and "]") and export as JPEG directly from VirtualDub then use any prog that can edit JPEG to resize it
 I downloaded all the movie clips from my cybershot and erased my memorystick, then I erased the .thm files now I'm trying to upload the videos to the camera and they wont show how can I recreate the .thm file of and mpg video clip???? thanks a lot
 This was spot on. I have thousands of images and hundreds of missing sidecars. Your technique worked flawlessly and help me out of a cataloging nightmare!

I have one suggestion which ended up saving me some time. Before starting I made sure to use my cataloging program (iMatch) to write at least one keyword to all the .crw files. Of course this operation would fail on those with missing sidecars. The important thing here is to make sure that every .crw *with* a .thm has at least 1 keyword.

Then in Adobe Bridge when you scan a folder there's a Keyword panel and one of the stats it lists is how many photo's have 0 keywords. If you click on it it 'filters' your files to just the ones with missing sidecars. Then I used your technique. It saved time because I didn't need to create .thms for all the .crw files....just the ones that needed it.
 Thanks for the great suggestion, Jeremy!


Leave a comment or suggestion for this page:

(Never Shown - Optional)