Save a Subsection of an Image in LabVIEW

Updated May 18, 2023

Reported In


  • LabVIEW

Issue Details

I want to load an image file in LabVIEW and save a cropped version of the image.

I only want to display a subsection of an image file in my Front Panel. 


By using LabVIEW's Picture Functions and Graphics Formats palettes, you can easily read, crop, and save an image file.

  1. Use the appropriate Read X File VI for your image file type (where "X" is your file type: JPEG, BNG, PNG, etc) to process the image file.
  2. Convert the image into a 2D array using the Unflatten Pixmap VI in the Graphics Formats palette. This 2D array holds the image's pixel data.
  3. Wire this array into Array Subset, and specify the indices of the desired image subsection to create an array of the subsection pixel data.
  4. Input this new subsection array into the Flatten Pixmap VI to convert the pixels back into image data.
  5. Use the Write X File VI to save the data, or the Draw Flattened Pixmap VI (located in the Picture Functions palette) to display the cropped version of the image on the front panel.

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

Additional Information

A sample image is provided in the attachments below.