LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save an acquired image?

Hello I have built a function which snaps an image. However I am struggling how to save that image, any help in how to do this is welcome.

 

save.jpg

 

0 Kudos
Message 1 of 5
(3,339 Views)

@navman74 wrote:

Hello I have built a function which snaps an image. However I am struggling how to save that image, any help in how to do this is welcome.

 

save.jpg

 



Provide a Folder Path (Place to store image file) with dynamic File name(Name of the image file Name) in Buid path.

 

Bfore saving make sure you can able to view the Acquired image in front panel by connecting to an indicator.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 5
(3,330 Views)

Hello thanks for the reply. I have done so but I want to be able to name the individual pictures, how can I do this?

 

Thanks

save2.jpg

0 Kudos
Message 3 of 5
(3,324 Views)

In order to save an image to a file, you must provide a named Path for the file.  Typically, you decide on a Folder where you want the images stored, you decide on a File Name (meaning the characters before the extension), and you choose an extension appropriate for the type of file you are saving.

 

If you want to save multiple images, you need multiple file names.  There are various schemes you can use to "auto-generate" these names.  Here's one:

  • Outside your For or While loop, choose the Folder where you'll store all the Images, and a base Image Name (say, "MyPix").  Have in mind the appropriate extension (say .bmp).
  • Inside the loop, use Format Into String to take the loop index ("i") and build a serial string out of it, using a format such as "MyPix_%03d.bmp".  This will build a string that looks like "MyPix_123.bmp" (assuming the index was 123) -- the %03d means "3-digit numeral with leading 0's".  If you expect more than 1000 pictures, of course, make it %04d.
  • Use Build Path to combine your Folder Path with your File Name and wire that to IMAQ Write File.  I strongly recommend putting the Write File function on the Error Line (just in case it can't write, so you'll know about it).

Bob Schor

0 Kudos
Message 4 of 5
(3,315 Views)

@navman74 wrote:

Hello thanks for the reply. I have done so but I want to be able to name the individual pictures, how can I do this?

 

Thanks

save2.jpg


See the attched Vi For your Reference on how to generate file names dynamically as per your requirement

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 5 of 5
(3,281 Views)