From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically displaying an animated GIF/video on the front panel

Solved!
Go to solution

Hello, I'm trying to display an animated GIF/video on the front panel. I want to display a different GIF/video (that starts automatically) based on some user event. I've tried the OpenG Read GIF File, but it is extremely slow, think 20 seconds to load one GIF file. So not an option. I saw some solutions using .NET containers or ActiveX components, but I'm not familiar with these things at all, so I've been struggling with this issue to no avail. Could someone help me to solve this problem, or guide me in the right direction?

0 Kudos
Message 1 of 6
(4,176 Views)
Solution
Accepted by topic author Basjong53

One of the simplest ways is to use the "Classic Pict Ring." You want to use the classic because you can make the ring box itself invisible so all you see is the picture.

 

Add the picture ring. While the picture ring is selected click 'Edit' -> 'Import Picture to Clipboard'. Then right click on the picture ring and select 'Import Picture After'. It should now show up in the pict ring. You can programmatically hide the ring, enable it, etc... I attached a vi doing just that, with the accompanying GIF it works with.

 

Warning though, the gif loads quickly, but it does go at a slower pace than if you just viewed it normally. This is just one option.

Download All
Message 2 of 6
(4,140 Views)

Wow, that is surprisingly simple. However I have two questions

1. Would it be possible to add files to the ring programmatically or only with the import from clipboard option?

2. If I add, say, 20 files in the ring, does it affect memory much? e.g. do all the gifs always play, or only when the specific index is selected?

0 Kudos
Message 3 of 6
(4,123 Views)

1 - I am not sure. I don't see an immediate way where you can add pictures programmatically during run time.

2 - It doesn't look like having tons of them increases the memory used by the program. I added 20, and the program running used only slight more memory than when I had one. (like 5mB more)

Message 4 of 6
(4,096 Views)

It's not so much a problem as they only need to be inserted once. Thank you for your answer.

0 Kudos
Message 5 of 6
(4,056 Views)

In this post in the Picture Control Thread I included a link (many years ago) to some example code that mucked about with picture controls and animated gifs.

 

Ben

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