LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a picture thumbnail?

Hi,

I'm developing a LabView program to display a series of face pictures on a projector and record peoples reactions to them eg, man or woman, young or old, happy or sad etc and their reaction times for a psychology experiment.

During the experiment the pictures are displayed in a sub vi's front panel and I've sized the picture box to 450x450.

The pictures to be displayed have to be prepared in Photoshop by cropping them square and then setting the image size to 450x450.

Elsewhere in the program I would like to be able to show a much small thumbnail preview of the pictures, say 100x100. I don't want to display just a small section of the image, I want to show the whole image but some how reduce it to fit in a 100x100 box. Any ideas how I can do this?

The file format of the pictures is jpeg and I would preferably like to stick with this format but could change if need be.

Thanks,
Dave.
0 Kudos
Message 1 of 3
(3,456 Views)
Dave,

The simplest thing to do would be to make use of the Zoom capability of the Picture Control (introduced sometime in the last couple of versions, I think).

If you create a Property Node for the picture box of interest, you will see a property called ZoomFactor near the bottom of the list. Just use the appropriate scaling factor (0.222 for your 450->100 example), and you should get a reasonable-looking thumbnail. A significant advantage of this approach is that you don't have to manage multiple scaled versions of the same image, and you can also vary your thumbnail size at run-time without having to do any extra work.

This method could possibly become intractable for memory-related reasons if you want to display a large number of scaled thumbnails of very large images; I'm not sure if LabVIEW does any optimization under the hood when it scales a picture.

Regards,
John
Message 2 of 3
(3,450 Views)


@Johnner wrote:
Dave,

The simplest thing to do would be to make use of the Zoom capability of the Picture Control (introduced sometime in the last couple of versions, I think).

If you create a Property Node for the picture box of interest, you will see a property called ZoomFactor near the bottom of the list. Just use the appropriate scaling factor (0.222 for your 450->100 example), and you should get a reasonable-looking thumbnail. A significant advantage of this approach is that you don't have to manage multiple scaled versions of the same image, and you can also vary your thumbnail size at run-time without having to do any extra work.

This method could possibly become intractable for memory-related reasons if you want to display a large number of scaled thumbnails of very large images; I'm not sure if LabVIEW does any optimization under the hood when it scales a picture.

Regards,
John




That sounds ideal, I'll try it.

Thanks,
Dave.
0 Kudos
Message 3 of 3
(3,426 Views)