LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save an image when clicking a button (with a numerical filename)

Hi

I'm taking pictures of a 3D Picture Control panel. This is no problem.
The code that I'm using now just takes pictures and replaces those files. In the attachment you can see what I'm having so far.

The idea is every time a click a button it takes a picture of the 3D Picture Control panel and creates a new file (BMP/JPEG). It would be nice if I could see in the filename of that picture when it was taken. So if I click that button 5 times, it creates 5 different pictures (BMP/JPEG) at 5 different moments. For example
: Pic 1 17/04/2009 18:43:15, Pic 2 17/04/2009 18:43:20, Pic 3 17/04/2009 18:44:59, Pic 4 17/04/2009 18:50:02,....
Can you help me please?

Thank you.

0 Kudos
Message 1 of 15
(3,568 Views)
Use the Time functions to get a string for your time and append that to the base part of your name. For example, Format Date/Time String.
Message 2 of 15
(3,554 Views)

Hi,

 

my 2cents:

-As slashes, backslashes and colons are "tricky" to use in filenames you should get rid of them.

-A naming scheme of "(YY)YYMMDD_HHMMSS_name" results in the same sorting order for "sort by name" and "sort by creation date"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 15
(3,547 Views)

Hi

I think I can manage the "date/time in filename" problem now. Thanks for that.
But I'm still having some difficulties regarding the idea about creating a new jpeg file every time I click a button and not just replacing one.
What do you suggest?

Thanks

0 Kudos
Message 4 of 15
(3,529 Views)

Hi 9 digit number,

 

I would also suggest to use smercurios advice of "Format date/time string", maybe with a format like "%Y%m%d_%H%M%S_Pic.jpg"...

 

But: first you say "I can manage the "date/time in filename" problem" and then you still overwrite older files? How fast/often do you want to save pictures? Would a simple counter do the trick too?

Message Edited by GerdW on 04-18-2009 10:18 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 15
(3,523 Views)

Hi

When the values of my measurements are high I want to take a picture. It doens't have to be very fast. I just want to be able to take a picture by just clicking the button so that I don't lose time filling in the name + searching for the folder where I want to save it in. And yes I think a counter would work but I havn't got a clue how to start with that in Labview 8.6.

Thank you for the previous responses.

0 Kudos
Message 6 of 15
(3,502 Views)
A counter need not be anything more than a shift register attached to your loop. I assume you have a loop, right? You only showed a small snippet of code. You can use an event structure to handle responding to the button press or you can simply check the value of the button within your acquisition loop. If you post the rest of your code then we can comment further.
Message 7 of 15
(3,496 Views)

Hi

I'm not using a loop in the "take a picture part". I'm just using a loop to get continuous measurements from my external device.

Here is my complete code. The buttons simulate different input signals.

Thanks

0 Kudos
Message 8 of 15
(3,484 Views)

Hi,

 

you still don't use "Format Date/Time" in your vi? Why not make files using different filenames instead of your filename constant?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 15
(3,479 Views)

Hi 

I can but the date/time in a string and view it in an indicator and it works just fine but when i connect it to the Write JPEG Vi, it fails.
Can somebody explain me why this code doesn't work?

Thanks

0 Kudos
Message 10 of 15
(3,459 Views)