Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JPEG Thumbnails

Status
Not open for further replies.

robrichardson

Programmer
Mar 14, 2001
86
GB
Help!!! Whilst I have some hair left to pull out!!

Part of a program I am writing allows the user view the contents of a folder as JPEG thumnails. I am using a filtercombobox, a directorylistbox and a filelistbox to navigate and list the files (JPEGs only). If there are JPEGs present then I would like the program to display them as thumbnails on a Tab Page on the same form. There can be variable number of JPEGs in the directory.

Please help - I'm getting desperate!!
 
How are you trying to show the thumbnails? I know that JPEG's require a little more work to view than BMP. You might want to go to where they have an article on how to use a JPEG library with BCB.
James P. Cottingham
 
It doesn't really matter how the JPEG is displayed, ideally the contents of the filelistbox will be displayed next to each other as small thumbnails (say 5cm x 5xm) on a tab page. I have had a look at your link and I am still none the wiser. I already know how to assign a JPEG to an image control, the problems I have is that I don't neccesarily know how many JPEGs there will be in each directory, so I guess I have to create the image components at runtime. Or do I use one large canvas and draw each image into a new position on the canvas. I really don't know which approach to take as obviously memory handling is important. Any suggestions would be helpful.

 
Could you do a count on the directory searched and find out how may files with *.JPG there are? You could use the FindFirst, FindNext functions. Once you have that number, can you create the number of cells needed at runtime?
James P. Cottingham
 
I've managed to work out how many JPEGs there are. The problem I have is the "cells", what do I use for cells and how do I create them at runtime?
 
I'm not familar with how to display a JPEG image so I don't know what component you are using. I've seen examples on how to create thumbnails of BMP graphics but not JPEGs. What component would you use to display a single JPEG?

Have you thought of showing a list of the JPEG names in a list box, then when the user highlights the name, the picture is displayed on screen? It might not be as useful as a thumbnail, though.

One place to visit is and look at the source code for JPEG Explorer. It might have some hints. It uses COM to produce its graphics.
James P. Cottingham
 

TJPEGImage *JImage = new TJPEGImage;
JImage->LoadFromFile(FileListBox1->FileName.c_str());

Image1->Width = JImage->Width;
Image1->Height = JImage->Height;
Image1->Picture->Assign(JImage);
Image1->Stretch = true;
delete JImage;

I am using the above code to load a single JPEG. I have looked at the JPEG explorer and its all in delphi.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top