Describes how an image pixel should be interpreted. Any interpretation other than Raw will apply a specific processing to every pixel of an image.

Note: this is unrelated to the file format / encoding (like JPG and PNG). This interpretation occurs after the image was decoded into a pixel buffer.

// Use the raw interpretation
const raw = Interpretation.Raw;

// Use the min/max scaling interpretation
const min = 234.22;
const max = 994.1;
const minmax = Interpretation.ScaleToMinMax(min, max);

// Negates the sign of all pixel values, without any interpretation.
// This is useful if your dataset expressed depths (positive values going down) rather than
// heights (positive values going up).
const custom = new Interpretation(Mode.Raw, {
negateValues: true,
})

Constructors

Accessors

  • get negateValues(): undefined | boolean
  • Gets or set the sign negation of elevation values. If true, reverses the sign of elevation values, such that positive values are going downward, rather than updwards. In other words, interpret values as depths rather than heights.

    Returns undefined | boolean

  • set negateValues(v): void
  • Parameters

    • v: undefined | boolean

    Returns void

Methods

  • Returns true if this interpretation does not perform any transformation to source pixels.

    Returns boolean

  • Reverses the sign of elevation values, such that positive values are going downward, rather than updwards. In other words, interpret values as depths rather than heights.

    Returns this

  • Preset for compression.

    Compresses the input range into the 8-bit range. This is the inverse of Interpretation.ScaleToMinMax.

    Note: this is typically used to visualize high dynamic range images, such as 32-bit data, into the 8-bit range suitable for display.

    Parameters

    • min: number

      The minimum value of the dataset.

    • max: number

      The maximum value of the dataset.

    Returns Interpretation

    The interpretation.

    // We have a 16-bit satellite image with min = 200, and max = 4000. We wish to visualize it
    // without saturation.
    const interp = Interpretation.CompressTo8Bit(200, 4000);
  • Preset for scaling interpretation.

    Applies a scaling processing to pixels with the provided min/max values with the following formula : output = min + input * (max - min).

    Input can be either color or grayscale, and output will be either color or grayscale, depending on input.

    Note: this is typically used to encode elevation data into a 8-bit grayscale image.

    Parameters

    • min: number

      The minimum value of the dataset, that maps to 0.

    • max: number

      The maximum value of the dataset, that maps to 255.

    Returns Interpretation

    The scaling values.

    // We have a grayscale image that represents elevation data ranging from 130 to 1500 meters.
    // Pixels with color 0 will map to 130 meters, and the pixels with color
    // 255 will map to 1500 meters, and so on.
    const interp = Interpretation.ScaleToMinMax(130, 1500);