12-01-2008 05:28 AM
Dear all,
I am using a Picture Control in my VI just to display a picture to the user.
The image that i am inserting into the Picture Control is of about 100 KBytes.
But, the amount of memory it is taking on the disk is around 10 MB, which is making my program run very slow.
Why the Control is taking up so much of memory ?? Whats the remedy ??
Thanks,
Ritesh
Solved! Go to Solution.
12-01-2008 05:34 AM
The picture control does not use any compression, and function likes a printer. If you load a picture each pixel is seperetly written with 4 bytes + printing commands.
Maybe you have some code that duplicates the picture (locals), could you add your code?
Ton
12-01-2008 07:45 AM
ritesh024 wrote:Dear all,
I am using a Picture Control in my VI just to display a picture to the user.
The image that i am inserting into the Picture Control is of about 100 KBytes.
But, the amount of memory it is taking on the disk is around 10 MB, which is making my program run very slow.
Why the Control is taking up so much of memory ?? Whats the remedy ??
Thanks,
Ritesh
Are you repeatedly present the iamge to the control?
The Pciture control only takes CPU when the images is being changed.
Please post an example that demo's your situation so we can be of further assistance.
Ben
12-02-2008 06:45 AM
Hi Ritesh,
What version of LabVIEW are you using?? also, please post the VI if you can...
Regards,
Vaibhav
12-03-2008 02:29 AM
Hi all,
I did not write any code yet.
What i did was just added the picture to the picture control. I added around 10 pics and when saved, the size of the VI i checked was around 15 MB.
the picture is in JPEG format and its size is around 100 KB.
in actual i want to show 30 pics on the front panel to the user. if i add all, the size would become around 45-50 MB. and that would really slow down the execution.
I added the pic to the control in this way->
1) Open picture from Modern->Graph->Controls->Picture.
2) Right Click Picture->Advanced->Customize.
3)Right Click the Box-> Import file at same size. and the select the picture from the dard drive.
I am attaching some of the pics which i added to the pic control.
and let me know if there's another way of displaying pics on the front panel without consuming so much of memory.
Thanks,
Ritesh
12-03-2008 03:05 AM
12-03-2008 04:13 AM
If you want to optimize your memory consumption you can ofc rescale the pictures to size in a imaging program, however i dont really see how even 40 MB of pictures should make the program run very slow, unless you somehow load/unload/render it alot.
/Y
12-08-2008 11:21 PM
Ritesh,
Is your problem solved? Do let us know if you have further queries.
12-08-2008 11:40 PM
It doesn't matter what size the picture is on the screen, LabVIEW is still loading the entire picture into memory to display it at a much smaller size. So, you would be best suited to determine the size of picture you are goign to use and use a picture editing program to resize the images to the size you are actually going to use.
You can also dynamically load the images from the files. This will prevent the VI from becoming bloated on the hard drive. This doesn't lessen the memory usage used by the program during runtime, as the images still have to be loaded into memory to be displayed.
12-09-2008 01:00 AM
Hi all,
thanks alot for your valuable comments.
resizing the pic really solved the problem. When i reduced the image to 400*400, the size of the VI reduced dramatically and i could hardly make out any change in the quality of the pic on the screen.
Its running perfectly fine now.
Thanks,
Ritesh