IPI_LoadImage()

This subprocedure is used to load an image from either a character field or a STMF. The loaded image can then be used to perform other IPI operations such as IPI_ImageToPageSegment().

Images can be loaded from:

  • A provided RPG field in the pImageData parameter.
  • A STMF specified on the Stmf subfield of the IPI_LoadImageDS_t parameter

Many times an image may be Base64 encoded such as if it was received via a web service. IPI_LoadImage() can decode a Base64 encoded image and then proceed to load it if the Base64Encoded subfield of the IPI_LoadImageDS_t parameter is set to IPI_YES. If the image is not Base64 encoded, this subfield should be set to IPI_NO.

Once the image has been loaded, an IPI_ImageDS_t data structure will be returned. This is used to provide important information about the image to other IPI subprocedures.

Subprocedure Prototype

D IPI_LoadImage...
D                 PR              N   Extproc('IPI_LoadImage')

Returns *OFF if an error occurs during processing, *ON otherwise.

D  pImageDS                           LikeDS(IPI_ImageDS_t)

Return parameter that contains the loaded image which can be used with other IPI subprocedures.

D  pLoadImageDS                       Const LikeDS(IPI_LoadImageDS_t)

Controls how the image data is loaded and can be used to provide an IFS STMF to load data from.

D  pImageData                     A   Const Len(16773100) Varying(4)
D                                     Options(*Varsize:*Omit)

May be used to pass image data

D  pErrorDS                           LikeDS(IPI_ErrorDS_t)
D                                     Options(*Nopass:*Omit)

Optional parameter that, if passed, will contain error data returned from the subprocedure. If it is not passed, exceptions will instead be "thrown" and must be caught by a MONITOR block.

Data Structures

D IPI_LoadImageDS_t...
D                 DS                  Qualified Template Inz
 
D  Base64Encoded...
D                                 N   Inz(IPI_YES)

Indicates whether the image data being provided is Base64 encoded.

Default Value: IPI_YES

Valid Values:

  • IPI_YES
  • IPI_NO

D  Stmf                       8192A   Varying

Specifies a path to a STMF in the IFS where image data should be loaded from.

D  InputCcsid...
D                               10I 0 Inz(IPI_CCSID_JOB)

Indicate which CCSID the image data is currently stored in.

Default Value: IPI_CCSID_JOB

D  ImagePointer                   *   Inz(*Null)

Internal use only

D  ImagePointerLength...
D                               10U 0 Inz(0)

Internal use only

D IPI_ImageDS_t   DS                  Qualified Template Inz
 
D  Format                       20A   Varying

Internal use only

D  Bytes                        10U 0 Inz(0)

Internal use only

D  Width                        10U 0 Inz(0)

Internal use only

D  Height                       10U 0 Inz(0)

Internal use only

D  Image                          *   Inz(*Null)

Internal use only

D  ImageInfo                      *   Inz(*Null)

Internal use only

D IPI_ErrorDS_t   DS                  Qualified Template Inz
 
D  Subproc                     132A   Varying

Name of the subprocedure that encountered an error.

D  MessageId                     7A

Message ID corresponding to the error that occurred.

D  Message                    1024A   Varying

Error message text providing details about the error.