LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Picture control eats huge amount of memory

Solved!
Go to solution

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

0 Kudos
Message 1 of 10
(4,181 Views)

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

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 10
(4,179 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 10
(4,156 Views)

Hi Ritesh,

 

What version of LabVIEW are you using?? also, please post the VI if you can...

 

Regards,

 

Vaibhav

.......^___________________^
....../ '---_BOT ____________ ]
...../_==O;;;;;;;;_______.:/
.....),---.(_(____)/.....
....// (..) ),----/....
...//____//......
..//____//......
.//____//......
..-------
0 Kudos
Message 4 of 10
(4,117 Views)

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

 

0 Kudos
Message 5 of 10
(4,092 Views)
If labview handles pictures as bitmaps, a 1000x1000 picture will be 4MB, regardless of filesize
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 10
(4,087 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 10
(4,078 Views)

Ritesh,

 

Is your problem solved? Do let us know if you have further queries.

0 Kudos
Message 8 of 10
(4,025 Views)
Solution
Accepted by topic author LVCoder

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.

Message 9 of 10
(4,021 Views)

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

0 Kudos
Message 10 of 10
(4,013 Views)