# Saving Images with the Image Recorder Block

After adding Camera devices, the images that they acquire can be stored to specified directories using the Image Recorder Block.

1. From the Toolbox > Data Storage category, drag and drop an Image Recorder block onto the Task.

2. Double-click the block to open the Recorder Properties dialog, which is used to configure the input pins of the block.

3. Configure the parameters of the dialog:
   1. The Recorder Type parameter should be set to the type of image being output by the Camera device that will be connected to the block.
   2. The Root Directory parameter is used to specify the location of the directory that will be used to store the images.

   3. The Filename Format parameter specifies the format that will be used to name the image files.

      Note: The Root Directory and Filename Format parameters are used to construct the recorded image's file name, e.g. Root Directory + Filename + Image File Extension (.bmp/.cdb).

   4. The Record Mode specifies how the image files will be written to disk.Synchronous specifies that the block will write the image to disk and wait until it has completed. Asynchronous specifies that the image will be placed into a queue (a maximum of 32 images can be queued; if the queue is full, images will be discarded) to be saved in a separate thread, while the block continues to record images.

      Note:

      If Asynchronous is selected as the Record Mode, the Image Recorder block should be placed as either the last block in the Task, or after the last modification (i.e. the last time that the image is either processed or operated on by another block) of the image in the Task. Since Asynchronous mode records the images on a different thread, and the block does not wait for the recording to complete, the Task will continue to execute. If, for example, the image is to be processed by another VisionPro Tool Block later in the Task, this may lead to the Designer application crashing, because accessing VisionPro images from different threads at the same time, is not supported.

      If it is not possible to either place the Image Recorder block at the end of the Task or after the last modification to the image, you can make a copy of the VisionPro image and record the copied image. You can copy a VisionPro image in script with the following statement: Cognex.VisionPro.CogSerializer.DeepCopyObject(InputImage);

4. Press the Accept button to close the dialog.
5. Link the desired Camera device to the Image Recorder block:
   1. Link the Camera's output Image to the Image Recoder block's Object input.

   2. Typically, the Root Directory and File Path input pins are left unlinked and use the root directory and file format specified in the Recorder Properties dialog, or are configured to a tag that will define the inputs.