LabTalk Object Type:


The img object provides script access for processing on image window, such as zooming the window, loading an image file, etc.

This object is introduced in Origin 2021b.


Property Access Description
img.Current Read/write,

Get and set the current frame in video/multi-frame stacked image

img.ext$ Read only,

Get file type (file extension).

img.filesize Read only,

Get file size.

img.fps Read only,

Return the frames per second in video.

img.frames Read only,

Return number of frames in video/multi-frame stacked image.

img.GrayMax Read/Write,

Set the maximum value of the palette applied to the gray scale image. THe value should be 0 - 255.

img.height Read only,

Return the image width in pixel. Read only,

Get and set the frame increment when click >> or << button. Default is 1. Read only,

Show or Hide the Information Bar at the top of the iamge window. 1 = show, 0 = hide. Read only,

Return the linked image type when insert to other window.

0 = no link,
1 = link as image object to a Graph/Worksheet/Matrix/Layout window,
2 = link as background to a Graph window,
3 = link to a worksheet cell,
4 = link to a matrix object. Read/Write,

Get or set whether the media type: 1 = single-frame image; 2 = multiple-frame image; 3 = video. Note that when setting media type, you can only switch between single frame and multi-frame.

img.nav Read/write,

Set or get image window stack navigation mode:

0 = None
1 = Thumbnails
2 = Image
3 = Slider
img.nancolor Read/Write,

Get/Set color for missing values. See Color List here.

img.palette$ Read/Write,

Set or get the color palette applied to a gray scale image. Use img.palette$=""; to remove palette.

For example, img.palette$="blue"; to apply built-in "blue" palette.

img.pause Read/write,

Pause video on click in video/multi-frame stacked image.

1 = Enable pausing video on mouse click.
0 = Default. Disable pausing video on click. One must click [O] button to pause.
img.path$ Read/write,

Get and set the path of the image source file. After setting a new path using this property, you will need to refresh the image window to see the update.

img.pixel Read/write,

Wether to show image as actual size.

1 = show image as actual size, showing pixels as 1 to 1. This is the default mode when an image window is created.
0 = not show image as actual size. Image will always fit to the window size.
img.savedata Read/write,

Wether to save the image to the image window.

1 = Save the image to the image window. The window serves as image container.
0 = Link the image to its source file. Only the connection is saved. The image will be excluded when saving the project.

See details about "linked file" vs. "image container" here.

img.width Read only,

Return the image width in pixel.

img.XYUnit$ Read/write,

Get and set the unit of actual scale.


Method Description

Use to fit window size to image.


Import the specified image file fname$ to the image window. Return the image type:

0 = None
1 = Single Image
2 = Image Stack
3 = Video
4 = Linked Matrix Object

img.RevPal() Reverse the color palette applied to a gray scale image.
img.transfer(GraphName) Transfer the image inserted to a Graph window to a real Image window or inverse.
  • img.transfer(): Extract the image object inserted in the Graph window to a real Image window.
  • img.transfer(GraphName): Embed the image window to GraphName window as an object.

Refer to "Insert an Image File" document for details.

image.unit() Get and set the unit of an image.
  • img.unit()=; to get whether an image has unit: return 1 if has unit; return 0 if pixels
  • img.unit(0); to clear unit and reset back to pixels
  • i=img.unit(1, A); to convert 1 pixel to actual size, return value of Known Distance and put Unit of Lenght into %A. See details of setting scale of image on this page.