# 2.7.38 impImage

## Menu Information

Data: Import from File: Image to Matrix

This X-Function supports file re-import. See this topic for details.

## Brief Information

Import image file into a Matrix window

## Command Line Usage

 1. impImage fname:="C:\image\Sample.bmp"; 

2. impImage fname:="c:\image\Sample.bmp" options.thumbnail:=0 options.FirstMode:=4 options.names.FNameToBk:=0; 

3. fname$="C:\Images\Sample.jpg";impImage;  ## X-Function Execution Options ## Variables Display Name Variable Name I/O and Type Default Value Description File Name fname Input string fname$

Specify the filename of the image file to be imported.

File Info info

Input

TreeNode

<unassigned>

This is for displaying the file information in the dialog. Please do not use this variable.

Basic information of the file(s) (file size) to be imported is listed here.

Import Options options

Input

TreeNode

<unassigned>

Use this to specify the import mode. Please see the Descriptions section for details.

Output orng

Output

Range

<active>

This is used to specify the output range. See the syntax here.

Note: Matrices can exist as standalone windows or they can be embedded in a worksheet. The impImage X-Function is programmed to recognize embedded matrices and to treat them as a matrix rather than as a worksheet. Thus, when the active worksheet contains an embedded matrix, impImage is able to output the imported image to the embedded matrix in the active workbook sheet.

Header Info finfo

Output

TreeNode

<unassigned>

This is for outputting the header information. It is hidden from the GUI. Users are not advised to use this variable.

Filter trFilter

Input

TreeNode

<optional>

This is the TreeNode for filter. It is hidden from the GUI. Users are not advised to use this variable.

File Index fIndex

Output

int

<optional>

This is for internal use only.

Repeat Import reimp

Input

int

0

This is for internal use only.

## Description

This X-Function can be used to import image files to Origin matrix. It is accessible when workbook, matrix, or graph window is active. Supported image file types include:

• Bitmap (*.bmp)
• Graphics Interchange Format (*.gif)
• Joint Photographic Experts Group (*.jpg, *jpe, *jpeg)
• Zsoft PC Paintbrush Bitmap (*.pcx)
• Portable Network Graphics (*.png)
• Truevision Targa (*.tga)
• Adobe Photoshop (*.psd)
• Tag Image File (*.tif, *tiff)
• Windows MetaFile (*.wmf)
• Enhanced MetaFile (*.emf)

### Details on Some Dialog Options

• Import Options(info and options)
Please see this page for more details.

## Examples

The following example will show how to import multiple image files (which contain the same dimension) as the matrix objects into the matrix sheet.

1. Create a new project, then select menu Data: Import from File: Image to Matrix to open the images browser.
2. Select files from myocyte1.tif to myocyte8.tif in the folder <Origin Installation Folder>\Samples\Image Processing and Analysis\ and click the Add File(s) button. Then click the OK button to reach the impImage dialog.
3. In the impImage dialog, change 1st File Import Mode to Start New Books, then check the check-box Include File Path when Renaming Book, and other settings keep default, as the following image shows.
4. Click the OK button, and all images are imported into the same matrix sheet. Please note that the sheet name and book name depend on the name of the last imported image, because every image is imported, it will rename the sheet name and book name with the file name.