3.7.5.23 ImgImg-obj
LabTalk Object Type:
- Internal
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.
Properties:
Property
|
Access
|
Description
|
img.Current
|
Read/write, numeric
|
Get and set the current frame in video/multi-frame stacked image
|
img.ext$
|
Read only, string
|
Get file type (file extension).
|
img.filesize
|
Read only, numeric
|
Get file size.
|
img.fps
|
Read only, numeric
|
Return the frames per second in video or a multi-frame image.
|
img.frames
|
Read only, numeric
|
Return number of frames in video/multi-frame stacked image.
|
img.GrayMax
|
Read/Write, numeric
|
Set the maximum value of the palette applied to the gray scale image. THe value should be 0 - 255.
|
img.height
|
Read only, numeric
|
Return the image width in pixel.
|
img.inc
|
Read only, numeric
|
Get and set the frame increment when click >> or << button. Default is 1.
|
img.info
|
Read only, numeric
|
Show or Hide the Information Bar at the top of the iamge window. 1 = show, 0 = hide.
|
img.link
|
Read only, numeric
|
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.
|
img.max
|
Read only, numeric
|
For GeoTIFF image,return the Max values of the image.
|
img.mix
|
Read only, numeric
|
For GeoTIFF image,return the Mix values of the image.
|
img.media
|
Read/Write, numeric
|
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, numeric
|
Set or get image window stack navigation mode:
- 0 = None
- 1 = Thumbnails
- 2 = Image
- 3 = Slider
|
img.nancolor
|
Read/Write, numeric
|
Get/Set color for missing values. See Color List here.
|
img.palette$
|
Read/Write, string
|
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, numeric
|
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, string
|
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, numeric
|
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, numeric
|
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.unit$
|
Read/write, string
|
Get/set the unit of the GeoTIFF image.
|
img.width
|
Read only, numeric
|
Return the image width in pixel.
|
img.XY$
|
Read/Write, string
|
Get and set the XY coordinates mapping to the image. The coordinate string should arrange in the series of XFrom XTo YFrom YTo. The default unit of the coordinates is pixel (which can be set by img.XYUnit$).
|
img.XYUnit$
|
Read/write, string
|
Get and set the unit of actual XY scale.
|
img.ZUnit$
|
Read/write, string
|
Get and set the unit of image frames (Z dimension) in a multi-frame image. XYZ values of a single frame are the pixel values.
|
img.ZName$
|
Read/write, string
|
Get and set the Long Name of image frames (Z dimension) in a multi-frame image.
|
Methods:
Method
|
Description
|
img.fit(value)
|
Use to fit window size to image.
0 = fit window to image
1 = image fit width of window
2 = image fit Height of Window
|
img.load(fname$)
|
Import the specified image file fname$ to the image window.
|
img.media(value)
|
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.
|
Samples:
Example 1
//Activate Image1 window. Get XY coordinates
string strxy$=img.xy$;
//Activate a Graph window you want to insert the image to
layer.addImg(image1, 8);
|