LinearGradientImage

LinearGradientImage[gcol]
returns an image with values linearly changing from left to right based on gradient color gcol.

LinearGradientImage[{pos1,pos2}gcol]
returns an image where the gradient starts at and ends at .

LinearGradientImage[,size]
returns a linear gradient image of the specified size.

Details and OptionsDetails and Options

  • LinearGradientImage constructs a 2D or 3D image with constant gradient along a direction derived from the input specification.
  • Color scheme specification gcol can be either of the following:
  • {col1,col2,}blend of multiple color directives
    "name"ColorData["name"]
    ffunction f that returns a color based on a scalar distance
  • The argument passed to the function f is by default the normalized distance between a pixel and the line going through , perpendicular to .
  • Position specification can be either of the following:
  • {x,y} or {x,y,z}absolute pixel position
    Left,Right axis in 2D and 3D
    Bottom,Top axis in 2D, axis in 3D
    Front,Back axis in 3D
    Centercenter alignment
    {posx,}a list of named positions
  • Positions that are not constrained are taken to be centered.
  • By default, positions are assumed to be in the standard image coordinate system.
  • The default size is for 2D images and for 3D images.
  • LinearGradientImage[] is equivalent to LinearGradientImage[{Black,White}].
  • LinearGradientImage accepts the following options:
  • ColorFunctionAutomatichow each pixel should be colored
    ColorFunctionScalingTruewhether to scale the argument to ColorFunction
    DataRangeFullrange of coordinates in the original image
    Padding"Fixed"padding scheme
  • Possible settings for DataRange include:
  • Automatic in 2D, in 3D
    Full in 2D, in 3D (default)
    {{left,right},{bottom,top}}explicit coordinate ranges in 2D
    {{left,right},{front,back},{bottom,top}}explicit coordinate ranges in 3D

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Linear grayscale gradient from left to right:

In[1]:=
Click for copyable input
Out[1]=

Linear blend of colors from left to right:

In[1]:=
Click for copyable input
Out[1]=

Linear gradient image along a given direction:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2014
(10.0)