Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2026-03-23 The HDF5 Field Guide

Loading...
Searching...
No Matches
Fortran High Level Images (H5IM) Interface

## Detailed Description

See also
  HDF5 Images API (H5IM), C-HL API
  HDF5 High Level Images, User Guide

## Modules
module | h5im
| This module contains Fortran interfaces for H5IM.

## Functions/Subroutines
subroutine | h5imget_image_info_f (loc_id, dset_name, width, height, planes, interlace, npals, errcode)
| Gets information about an image dataset (dimensions, interlace mode and number of associated palettes).
subroutine | h5imget_npalettes_f (loc_id, image_name, npals, errcode)
| Gets the number of palettes associated to an image.
subroutine | h5imget_palette_f (loc_id, image_name, pal_number, pal_data, errcode)
| Gets the palette dataset.
subroutine | h5imget_palette_info_f (loc_id, image_name, pal_number, pal_dims, errcode)
| Gets information about a palette dataset (dimensions).
integer function | h5imis_image_f (loc_id, dset_name)
| Inquires if a dataset is an image.
integer function | h5imis_palette_f (loc_id, dset_name)
| Inquires if a dataset is a palette. Returns zero (false), a positive (true) or a negative (failure) value.
subroutine | h5imlink_palette_f (loc_id, image_name, pal_name, errcode)
| This function attaches a palette to an existing image dataset.
subroutine | h5immake_image_24bit_f (loc_id, dset_name, width, height, il, buf, errcode)
| Creates and writes an image a 24 bit image.
subroutine | h5immake_image_8bit_f (loc_id, dset_name, width, height, buf, errcode)
| Creates and writes an image an 8 bit image.
subroutine | h5immake_palette_f (loc_id, pal_name, pal_dims, pal_data, errcode)
| Creates and writes a palette.
subroutine | h5imread_image_f (loc_id, dset_name, buf, errcode)
| Reads image data from disk.
subroutine | h5imunlink_palette_f (loc_id, image_name, pal_name, errcode)
| This function detaches a palette to an existing image dataset.

## Function/Subroutine Documentation

## ◆ h5imget_image_info_f()

subroutine h5imget_image_info_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(inout) | width,
|  | integer(hsize_t), intent(inout) | height,
|  | integer(hsize_t), intent(inout) | planes,
|  | character(len=*), intent(inout) | interlace,
|  | integer(hsize_t), intent(inout) | npals,
|  | integer | errcode )

Gets information about an image dataset (dimensions, interlace mode and number of associated palettes).

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset.
  width | The width of the image.
  height | The height of the image.
  planes | The number of color planes of the image.
  interlace | The interlace mode of the image.
  npals | The number of palettes associated to the image.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMget_image_info()

## ◆ h5imget_npalettes_f()

subroutine h5imget_npalettes_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | image_name,
|  | integer(hsize_t), intent(inout) | npals,
|  | integer | errcode )

Gets the number of palettes associated to an image.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  image_name | The name of the image dataset.
  npals | The number of palettes.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMget_npalettes()

## ◆ h5imget_palette_f()

subroutine h5imget_palette_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | image_name,
|  | integer, intent(in) | pal_number,
|  | integer, dimension(*), intent(inout) | pal_data,
|  | integer | errcode )

Gets the palette dataset.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  image_name | The name of the image dataset.
  pal_number | The zero based index that identifies the palette.
  pal_data | The palette dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMget_palette_info()

## ◆ h5imget_palette_info_f()

subroutine h5imget_palette_info_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | image_name,
|  | integer, intent(in) | pal_number,
|  | integer(hsize_t), dimension(*), intent(inout) | pal_dims,
|  | integer | errcode )

Gets information about a palette dataset (dimensions).

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  image_name | The name of the image dataset.
  pal_number | The zero based index that identifies the palette.
  pal_dims | The dimensions of the palette dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMget_palette_info()

## ◆ h5imis_image_f()

integer function h5imis_image_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name )

Inquires if a dataset is an image.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset.

See C API: H5IMis_image()

## ◆ h5imis_palette_f()

integer function h5imis_palette_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name )

Inquires if a dataset is a palette. Returns zero (false), a positive (true) or a negative (failure) value.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset.

See C API: H5IMis_palette()

## ◆ h5imlink_palette_f()

subroutine h5imlink_palette_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | image_name,
|  | character(len=*), intent(in) | pal_name,
|  | integer | errcode )

This function attaches a palette to an existing image dataset.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  image_name | The name of the dataset to attach the palette to.
  pal_name | The name of the palette.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMlink_palette()

## ◆ h5immake_image_24bit_f()

subroutine h5immake_image_24bit_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(in) | width,
|  | integer(hsize_t), intent(in) | height,
|  | character(len=*), intent(in) | il,
|  | integer, dimension(*), intent(in) | buf,
|  | integer | errcode )

Creates and writes an image a 24 bit image.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  width | The width of the image.
  height | The height of the image.
  il | String defining the interlace mode.
  buf | Buffer with data to be written to the dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMmake_image_24bit()

## ◆ h5immake_image_8bit_f()

subroutine h5immake_image_8bit_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(in) | width,
|  | integer(hsize_t), intent(in) | height,
|  | integer, dimension(*), intent(in) | buf,
|  | integer | errcode )

Creates and writes an image an 8 bit image.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  width | The width of the image.
  height | The height of the image
  buf | Buffer with data to be written to the dataset
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMmake_image_8bit()

## ◆ h5immake_palette_f()

subroutine h5immake_palette_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | pal_name,
|  | integer(hsize_t), dimension(*), intent(in) | pal_dims,
|  | integer, dimension(*), intent(in) | pal_data,
|  | integer | errcode )

Creates and writes a palette.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  pal_name | The name of the palette.
  pal_dims | An array of the size of the palette dimensions.
  pal_data | Buffer with data to be written to the dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMmake_palette()

## ◆ h5imread_image_f()

subroutine h5imread_image_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer, dimension(*), intent(inout) | buf,
|  | integer | errcode )

Reads image data from disk.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  buf | Buffer with data to store the image.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMread_image()

## ◆ h5imunlink_palette_f()

subroutine h5imunlink_palette_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | image_name,
|  | character(len=*), intent(in) | pal_name,
|  | integer | errcode )

This function detaches a palette to an existing image dataset.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  image_name | The name of the image dataset.
  pal_name | The name of the palette.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5IMunlink_palette()