13.7 SDO_GEOR_UTL.createImage

Format

SDO_GEOR_UTL.createImage(
  inData             IN     BLOB,
  height             IN     NUMBER,
  width              IN     NUMBER,
  bands              IN     NUMBER,
  cellDepth          IN     VARCHAR2,
  interleaving       IN     VARCHAR2,
  outData            IN OUT BLOB,
  outFormat          IN     VARCHAR2 DEFAULT 'PNG',
  nodataMapping      IN     MDSYS.SDO_NUMBER_ARRAYSET DEFAULT NULL,
  imageProcessing    IN     VARCHAR2 default NULL,
  statistics         IN     MDSYS.SDO_NUMBER_ARRAYSET DEFAULT NULL,
  histogram          IN     MDSYS.SDO_GEOR_HISTOGRAM_ARRAY DEFAULT NULL
);

or

SDO_GEOR_UTL.createImage(
  inData             IN     BLOB,
  height             IN     NUMBER,
  width              IN     NUMBER,
  cellDepth          IN     VARCHAR2,
  outData            IN OUT BLOB,
  outFormat          IN     VARCHAR2 DEFAULT 'PNG',
  colorMap           IN     MDSYS.SDO_GEOR_COLORMAP
);

or

SDO_GEOR_UTL.createImage(
  inData             IN     BLOB,
  height             IN     NUMBER,
  width              IN     NUMBER,
  cellDepth          IN     VARCHAR2,
  outData            IN OUT BLOB,
  outFormat          IN     VARCHAR2 DEFAULT 'PNG',
  grayScale          IN    MDSYS.SDO_GEOR_GRAYSCALE
);

Description

Create a JPEG, PNG, or TIFF image from the input data in a BLOB and write the created image into another BLOB.

Parameters

inData

The BLOB locator of the input binary raster data.

The input binary data represents the raster data in a rectangle window.

height

The height in cells of the rectangular window of the input data.

width

The width in cells of the rectangular window of the input data.

bands

The number of the bands of the input data.

cellDepth

The data type of the input data.

It can only have one of the values defined in the cellDepthType of the GeoRaster Metadata XML Schema.

interleaving

The interleaving type of the input data.

It can only have one of the following values: BSQ (band sequential), BIL (band interleaved by line), or BIP (band interleaved by pixel).

outData

The BLOB locator for the output image.

outFormat

The output image format.

It can only have one of the following values: PNG, JPEG, TIFF.

nodataMapping

Specify how NODATA cell value is rendered in the generated image.

This parameter is in the format of an array of number set. Each element of the array is a set of 4 numbers: (val1, val2, val3, val4).

  • val1 and val2: Specifies the NODATA cell value range as [val1, val2), which means any cell value that falls in this range is considered as NODATA cell value.
  • val3: Specifies the replacement value for the specified NODATA cell values. val3 can be null if no replacement is needed.
  • val4: This can have a value of 1 or 0.
    • 1: This means the specified NODATA cell is rendered as transparent in the output image.
    • 0: This means the specified NODATA cell is not rendered as transparent in the output image.
imageProcessing

Specifies the image processing method that is to be applied on the retrieved raster data.

The valid values are:

  • "stretch": Stretch the raster data cell values range to [0,255].
  • "piecewisestretch": Stretch the raster data cell values range to [0,255], but enhance the brightness and contrast of the image area with low cell values.
  • "normalize": Process the raster data cell values to have a mean value of 128 and a standard deviation of 64.
  • "equalize": Apply the equalization on the raster data cells based on its histogram.
  • "terrainRGB": Generate the Mapbox TerrainRGB image based on the one band DEM (Digital Elevation Model) raster data. This is used to configure raster-DEM source in Maplibre or Mapbox.
statistics

The statistics of the input raster data.

This is used by the image processing methods: "stretch", "piecewisestretch", and "normalize". Each element of the array is a set of statistics value (min, max, mean, and std) of the band.

histogram

The histogram of the input raster data.

This is used by the image processing method equalize.

colormap

The colormap for the created image.

This only applies to one band input raster data.

grayscale

The grayscale table definition for the created image.

This only applies to the one band input raster data.

Usage Notes

There are three formats of the SDO_GEOR_UTL.createImage procedure. The formats that include colormap or grayscale parameters are for 1-band input raster data only, and the created image is associated with the given colormap or grayscale table.

The format that excludes colormap or grayscale parameters supports the input raster data with 1, 2, 3, or 4 bands, where for the 2 or 4 bands input rasters, the second or the fourth band is treated as the alpha band. However, 4-band image is not supported for the JPEG output format.

Note:

If you are using the Autonomous AI Database environment, then Oracle Java needs to be enabled for this feature. See Enable Oracle Java for more information.

Examples

The following example creates a 3-band PNG image from an input 256x256x3 raster data in lb1 and saves it in lb2:

sdo_geor_utl.createImage(lb1, 256, 256, 3, ‘8BIT_U’, ‘BIP’, lb2, ‘PNG’);

The following example creates a 3-band PNG image from a 256x256x3 input raster data in lb1, maps the cell value of 150 to 0, makes it transparent, and saves the image in lb2:

sdo_geor_utl.createImage(lb1, 256, 256, 3, ‘8BIT_U’, ‘BIP’, lb2, ‘PNG’,
      sdo_number_arrayset(sdo_number_array(150, 150, 0, 1));

The following example creates a 3-band PNG image from a 256x256x3 input raster data in lb1, stretches it and saves it in lb2. The statistics of the input raster is provided in the input parameter.

sdo_geor_utl.createImage(lb1, 256, 256, 3, ‘8BIT_U’, ‘BIP’, lb2, ‘PNG’, null,
      ‘stretch’, sdo_number_arrayset(sdo_number_array(30, 80, 50.32, 15.2), 
      sdo_number_array(25, 80, 55.8, 10.62), sdo_number_array(28, 78, 52.25, 15.5);

The following example creates a 3-band terrainRGB PNG image from a 256x256 1-band input DEM raster data in lb1 and save it in lb2:

sdo_geor_utl.createImage(lb1, 256, 256, 1, ‘16BIT_U’, ‘BIP’, lb2, ‘PNG’, null,
      ‘terrainRGB’);

The following example creates a 256x256 1-band TIFF image with the given colormap, and saves it in lb2:

sdo_geor_utl.createImage(lb1, 256, 256, ‘8BIT_U’, lb2, ‘TIFF’, sdo_geor_colormap(
  sdo_number_array(0, 100, 150, 160), sdo_number_array(255, 255,   0, 0),
  sdo_number_array(255,   0, 255, 0),  sdo_number_array(255,   0,   0, 255),
  sdo_number_array(255, 255, 255, 255));