LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save pictures with the config file "Write Key.vi"

hi all,

 

On my front panel I've few controls pictures containing photos (JPG type) . The user can select the photo he wants using the classic file dialog box.

Usally I use the config files VI's to save the control values from one run to another one. In the config files VIs, I use the polymorphic "write Key.vi" wich accept only booean, I32, U32, path, and string dada type, but no picture !

I've tried the "flatten to string" fonction (picture --> flatten to string --> writekey.vi) , no broken wire but the conversion is very very too long and to heavy (20Mo a key!).

 

another way, would be to write in a xml file, I've also tried but I've always get the 1104 error: No end tag was found for an XML start/end tag pair.

 

can someone help me.

 

what is the best way for  retrieving controls pictures with photos

0 Kudos
Message 1 of 4
(3,477 Views)

Hi Pascalou,

 

you can't save pictures in a config file as string length is limited to 255 chars...

But you can save the path to the file instead and load the picture after reading the config file!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(3,466 Views)

Hi GerdW

 

Many thanks for your quick answer. Always happy to get advises from fellow programmers.

You suggest to use the "pathinput of the "write key.vi" (configuration file utilities) to retrieve photos that a user would have selected in a previous run. Could be a good solution in a number of applications but what I would like to do is like in a excel or word file. Once a photo has been embeded in one xls file for ex., I find it back each time i open this xls file, even if the original photo's file has been deleted or if my application runs on another computer.

xml file looks interesting for that purpose (i mean used as config file). I can easily store in a xml file a labview picture (like a colored rectangle e.g.) but when i try with a photo (wich is a also a picture) labview returns always the error 1104.

How to fixe this error, or maybe  there is another way to store photos in a config file without passing through xml,

 

kind regards.

 

0 Kudos
Message 3 of 4
(3,403 Views)

Hi pascalou,

 

error# 1104 means "couldn't find end tag" - it seems the embedded picture is too big for LabView. I don't have the XML functions available, so I can't check them for any size restrictions...

 

What about using your own file format? How much information do you need to store?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(3,399 Views)