Example Code

Extract A User Selectable Part Of An Image As New Image

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • Vision Development Module
  • LabVIEW

Code and Documents



This VI allows users to select a rectangular Region of Interest (ROI) and save that ROI to its own image file.  This would be useful if you would like to extract out a portion of your larger image and save it as its own image file.



This VI uses the IMAQ VI's to create a memory location for an image, open that image and then display it. The VI then uses the IMAQ Select Rectangle to open a prompt which allows the user to define a rectangular Region Of Interest (ROI). The IMAQ Extract VI creates a new image for the ROI which is then saved to file.




  • LabVIEW Base Development System 2012 (or compatible)
  • NI Vision Development Module 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)


  • No hardware is necessary to use this example VI


Steps to Implement or Execute Code

  1. Download and open the attached ZIP-file
  2. Open the VI and follow the instructions on the Front Panel


Additional Information or References

Extract A User Selectable Part Of An Image As New Image - Front Panel.png


Extract A User Selectable Part Of An Image As New Image - Block Diagram.png


**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**
Marti C
Applications Engineer
National Instruments
NI Medical

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.


Exactly what i was looking for! Thanks