If you would like to make some extra cash for surfing the web, jump to http://www.codeoftheweek.com/paidsurf.html
In this issue we discuss how to take any image and create a thumbnail version of it.
If you have any questions about using this module, let us know at questions@codeoftheweek.com
This module contains a single routine called CreateThumbnail that takes an image and creates a new version of the image in bitmap format that can be used as a thumbnail version of the original graphic. This is useful for any application that needs to show many large images in a smaller space (such as an image viewing program). It can also be useful for generating thumbnail graphics for use on the web (i.e. catalog images, product images, etc)
We are planning on expanding this module to include routines to aid in the creation of a full-blown image viewer. With the proliferation of digital cameras and online images we have been receiving many requests for routines to help manage these graphics. If you have any suggestions, drop us an email at image@codeoftheweek.com
Public Sub CreateThumbnail(Picbox As PictureBox, sImageFile As String, sThumbnailFile As String)
This routine requires the existence of a PictureBox on a form. It does not have to be a visible PictureBox. picbox is the PictureBox on your form. sImageFile is the name of the image file to load into picbox for which you want to create a thumbnail graphic. sThumbnailFile is the file that the thumbnail graphic will be saved into. It should have an extension of BMP since the SavePicture method that this routine uses only supports the saving of bitmaps.
It will not change the original graphic in any way.
Any errors which occur in this routine (such as a missing file) will be raised to the caller.
This example will take the image file called e:\pics\p1010023.jpg and convert it to a thumbnail called e:\pics\thumb-p1010023.bmp.
CreateThumbnail pic, "e:\pics\p1010023.jpg", "e:\pics\thumb-p1010023.bmp"
To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0120.html
If you would like to get paid for surfing the web, jump to http://www.codeoftheweek.com/paidsurf.html