For the latest version of JMP Help, visit JMP.com/help.


Publication date: 11/29/2021

Images

The Scripting Index provides examples for processing images. In JMP, select Help > Scripting Index to view this interactive resource.

Additional resources are available from the JMP File Exchange at https://community.jmp.com/community/file-exchange.

img<<Crop(Left(pix), Right(pix), Top(pix), Bottom(pix))

Creates a new image from an existing image to the specified dimensions (in pixels).

img<<Filter(name, <n>)

Filters the image based on the specified algorithm. Filtering is useful for cleaning up noise in the image.

Note: All of the JMP image filters are supported at the operating system level. Images that are processed on Windows might differ from images processed on macOS.

Argument

name

Specifies the quoted name of a JMP image filter. The following filters are available:

"Despeckle" removes defects (that is, speckles) from a scanned or captured image (for example, scratches, dust, etc.).

"Edge" identifies pixels in an image where the brightness changes sharply and darkens pixels with no sharp change. Edge detection is used to detect changes in surface, depth, material, and lighting.

"Enhance" reduces the contrast between pixels in a noisy image.

"Median" reduces noise (that is, the random variation) and smooths an image by comparing each pixel’s brightness with its neighbors’ and, if the value is very different, replaces it with the average of the neighbors’ values.

"Negate" creates the negative of the color or gray-scale image by changing each pixel color to its complementary color.

"Normalize" changes a color image’s pixels to use the full range of the file format’s number system. Normalization will make the image’s colors more intense.

"Sharpen" reduces blur by sharpening edges of an image.

"Contrast", n brightens or darkens an image. A higher number (>0.0) brightens an image; a lower number (<0.0) darkens an image.

"Gamma", n corrects the image visual display (brightness and intensity) to account for differences in monitor hardware. A higher number (> 1.0) lightens the image; a lower number (< 1.0) darkens the image.

"Reduce Noise", n reduces the random variation (or noise) that occurs with higher ISO sensitivity or longer exposure times.

"Gaussian Blur", radius, sigma reduces image noise and detail creating a smoother image. Radius is equal to the blur radius around each pixel and sigma is the standard deviation of the Gaussian distribution. Gaussian blur is commonly used when resizing or performing edge detection.

img<<Flip Both

Flips the image from left to right and top to bottom.

img<<Flip Horizontal

Flips the image from left to right.

img<<Flip Vertical

Flips the image from top to bottom.

img<<Get EXIF

Returns EXIF data from the image (such as the shutter speed and aperture value) in an associative array.

img<<Get N Frames

Description

Returns the number of frames in a multi-frame TIF or animated GIF file, where the number of frames begins with frame 0.

Example

The following example places a four-frame TIF file in a new window and shows the image that is in the first frame.

img = New Image( "$DOWNLOADS/Multiframe.tif" );
nframes = img << Get N Frames(); // return 4
img << Set Current Frame( 1 ); // show image 1
win = New Window( "Multi-Frame TIFF", img );

img<<Get Size

img<<Size

Returns a list containing the width and height (in pixels) of the image.

img<<Rotate(degrees)

Rotates the image by the specified number of degrees.

img<<Save Image(path)

Saves the image to the quoted path.

img<<Scale(scale|xscale, yscale)

Resizes the image by the specified dimensions. Provide one argument to resize both the width and height. Provide two arguments to resize the width and height separately.

Examples

img = New Image( "$SAMPLE_IMAGES/tile.jpg" );
xs = 2;
img << Scale( xs );
New Window( "Tilex 2", img );
 
img = New Image( "$SAMPLE_IMAGES/tile.jpg" );
img << Scale( 2, 0.5 ); // scale image width by 2 and height by 1/2
New Window( "Tile squished", img );

Notes

Using Scale is an alternative to getting the size of the image, multiplying by the scale factor, and then setting the size.

img<<Set Current Frame

Description

Sets the frame that shows in a multi-frame TIFF or animated GIF file. Specify 0 through the number of frames minus 1. For example, with four frames, you can specify frame 0 through frame 3.

See Also

img<<Get N Frames

img<<Set Size(width, height)

Resizes the image to the specified dimensions (in pixels). To scale the image proportionally, specify a width and height that correspond to the aspect ratio in the original image.

img<<Transparency(fraction)

Sets the transparency for the image where the fraction is between 0.0 (full transparency) to 1.0 (no transparency).

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).