Image
The Image function () makes it possible to import an image (in BMP, JPEG, PNG, GIF, or TIFF format) and map the image’s RGB (red, green, blue) data to a scalar (single-channel) function output value. By default the function’s output uses the mapping (R+G+B)/3.
The default Function name is im1. An image is defined on a two-dimensional domain, and you typically call the image function using spatial coordinates: im1(x,y).
See Function Names and Calling Functions for information about the Function name section.
See Common Settings for the Function Nodes for information about the Units section.
File
Enter the path and name of the image file in the Filename text field, or click Browse to select an image file in the Image dialog box. You can also click the downward arrow beside the Browse button and choose Browse From () to open the fullscreen Select File window. Click the downward arrow for the Location menu () to choose Show in Auxiliary Data () to move to the row for this file in the Auxiliary Data window, Edit Location () (if the location is a database), Copy Location (), and (if you have copied a file location) Paste Location (). Click Import () to import the image in the specified image file into the model; otherwise, COMSOL Multiphysics references the image on your file system. When you have imported the image, the File section, under Data imported into model, contains information about the image’s filename and size. Click Export to save the image to a file and reference it from there instead of keeping it in the model. Click the Discard button to delete the imported image data from the model. Click the Refresh button () to ensure that the file is reread when needed.
Coordinates
Define the 2D coordinates and if required, flip the image. Select the In place check box to use the pixels in the image as the coordinates. Click to clear the check box to define the image coordinates explicitly using the x minimum, x maximum, y minimum, and y maximum fields. Select the Flip horizontally check box to flip the image horizontally from left to right and vice versa. Select the Flip vertically check box to flip the image vertically from up to down and vice versa.
Color Scaling
From the Scaling list, select Automatic (the default) to use the default scaling, which outputs the mean of the RGB values for each pixel in the image. Select Manual to specify a custom expression for the scalar image function output value in the Expression field. The default is (r+g+b)/3, which is the automatic scaling, giving a scalar value that is the mean of the RGB values in each pixel.
For interpolation in the image, select an Interpolation method from the list: Nearest neighbor or Linear (the default).
For extrapolation of values that are outside the range in the image, select an Extrapolation method from the list: Constant (the default), Linear, Nearest function (which evaluates the function from the closest grid point at the actual point where a value is requested), or Specific value. If Specific value is selected, enter a value in the Value outside range field (default value: 0).
Clipping
Apply clipping to create a box-shaped region inside of the original image where the image is rendered. From the Clipping list, select None (the default) for no clipping, or Manual to define the box-shaped region using the x minimum, x maximum, y minimum, and y maximum fields (unit: px). The default x maximum and y maximum values are both 1000 px; the default minimum values are 0.