Click here to Skip to main content
13,258,763 members (47,898 online)
Click here to Skip to main content
Add your own
alternative version


15 bookmarked
Posted 28 Apr 2006

Windows Thumbnail Resizer

, 28 Apr 2006
Rate this:
Please Sign up or sign in to vote.
An article on how to make an application that lets you change the size of the thumbnails in Windows. These are the thumbnails you'll see when you click View -> Thumbnails in Windows Explorer.

Screenshot of the Windows Thumbnail Resizer


This article describes how to write an application that lets you change the size of the thumbnails in Windows. These are the thumbnails you'll see when you click View -> Thumbnails in Windows Explorer. It also covers some simple registry operations and image handling.


My wife works as a photographer, and she one day asked me if it's possible to make the thumbnails in Windows larger. I didn't know, but thought it would be weird if Microsoft hadn't made this feature. After a quick search, I found a tip by Diana Higgins at Lockergnome, on how to do it. And it worked as intended, so I started making this GUI front-end right away.

A screenshot of the registry key ThumbnailSize that we will focus on:

Screenshot of the registry key ThumbnailSize

How it works

Before we go into the details, I'll give a quick overview of what we need to do to make this work. First, we need a GUI to show how big the thumbnails are going to be. So, this part uses a simple Windows form with a slidebar on it. The image on the form is resized as the user drags the slidebar. The next part we need is functions to read the registry setting, and one to write it. So let's start...

Using the code

The code is heavily commented to make it easy for anyone to follow. It doesn't use any programmatically complicated functions. If there's anything in the code that can be a challenge to follow for a beginner - it has to be the registry handling functions. Therefore, these are explained in detail here. I will also recommend to download the source now and follow it through this article.

First things first. Since this application is a GUI front-end to the registry, we need functions to read and write to, you guessed it, the registry. I'll explain and show the code of the saveRegSettings() here. This functions takes a keyName and a keyValue as arguments, string an int respectively.

We then use a try clause to make everything a bit more failsafe. Inside the try, we set the RegistryKey key to the key \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer, and use the Registry.CurrentUser.CreateSubKey() to make a key called keyName which, at the time, can only be "ThumbnailSize". We then use RegistryKey.SetValue to give the key the value we want - keyValue. Now, everything is done, and we can close the key with RegistryKey.Close();.

This is a vital code-part of the application. The saveRegSettings is used to write to the Windows Registry:

 * This function saves the settings to the registry key.
 * valid keyName values are:
 * - ThumbnailSize    
public void saveRegSettings(string keyName, int keyValue) 
    RegistryKey key = null; 
    string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer";
    //Try to create the registry key...
        //Create the subkey...
        key = Registry.CurrentUser.CreateSubKey(subKey);
        //...give it a value...
        key.SetValue(keyName, keyValue);
        //...and then close it.
    catch(Exception ex)
        //Something failed, give a nice error message.
        Console.WriteLine("Edit: HKEY_CURRENT_USER\\" + 
                          subKey + "\\" + key + "\n" + 
        "ERROR: " + ex.ToString()); 
        //Finally - we clean up, that means closing the open registry key.

Since this application has some easy-to-understand image handling, I'll go through some of that too here, just to point it out. The code below loads the image from a file and displays it in the form. The way this is done is by using the Image.FromFile() function from System.Drawing. This takes a string with the image path as the argument. The resulting image is saved in an Image variable called img.

The next part makes a thumbnail of the now loaded image, and overwrites the old full-size image in the img variable. The tbThumbSize.Value is the value of the scrollbar, and represents the size of the thumbnail the user chooses. The makeThumbnail() takes three arguments, Image, maxWidth, and maxHeight. You'll see from the code that both are set to the same value. This way, we can use both portrait and landscape pictures, because the aspect ratio will be respected when making the thumbnail.

The last things we do are set the label equal to the scrollbar value, and then clean up. That's it!

//Try to load the demo image
img = Image.FromFile(Application.StartupPath + "\\Sunset.jpg");

//Try to resize (make a thumbnail) of the demo image.
img = ph.makeThumbnail(img, tbThumbSize.Value, tbThumbSize.Value);    

//Set the thumbnail size in the label
lblThumbSize.Text = tbThumbSize.Value + " x " + tbThumbSize.Value;

//Set the Image property of the picture 
//container to the newly loaded image.
picThumb.Image = img;
ph = null;


This shows you how to make an application to change the Windows thumbnail size. However, it's very easy to adapt these techniques to change anything else in the Windows registry. For example, you can make an application that reads and lets the user change the applications that Windows loads on startup.

If you haven't done it already, now is a good time to download the source code and start experimenting with it.


  • 28th of April 2006 - Initial release.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

J.R. Odden
Web Developer
Norway Norway
Working as a system consultant at a Norwegian consultant company. Main fields of work are .NET programming, SQL 2005, Reporting Services and MSI installations.

J.R. has a BSc in Computer Science and have worked 3 years as a developer at projectiondesign making projector network firmware.
Hobbies include OpenGL programming, rock climbing and cars.

You may also be interested in...

Comments and Discussions

GeneralGetThumbnailImage Pin
mr.stick28-Apr-06 2:21
membermr.stick28-Apr-06 2:21 
GeneralRe: GetThumbnailImage Pin
J.R. Odden28-Apr-06 2:44
memberJ.R. Odden28-Apr-06 2:44 
mr.stick wrote:
Just as a general tip, it's probably not a good idea to use GetThumbnailImage for anything where the size is going to be increased by a fair amount.

I think that this method gets the thumbnail that is already associated with the image and resizes it to the dimensions passed in, rather than generating a new thumbnail of the size you requested. Obviously this means that for a large increase in size, you would end up with a very poor, stretched image. It probably doesn't make a difference in this implmentation, but it's something that I remember being an issue for me in the past.

Thanks for the tip, I'll keep that in mind in the future. And you're right, it doesn't show when the max size of the pictures are 255x255 pixels.

mr.stick wrote:
Nice article though, I didn't even know that the registry key in question even existed.

Thanks Smile | :) It actually doesn't exists - you have to make it.

GeneralMicrosoft PowerToys for Windows XP Pin
axelriet28-Apr-06 2:10
memberaxelriet28-Apr-06 2:10 
GeneralDownload Pin
g_p_l28-Apr-06 1:58
memberg_p_l28-Apr-06 1:58 
GeneralRe: Download Pin
J.R. Odden28-Apr-06 2:08
memberJ.R. Odden28-Apr-06 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 28 Apr 2006
Article Copyright 2006 by J.R. Odden
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid