# 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()](https://isupport.katointegrations.com/ipi/ipi_imagetopagesegment.md). 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 | Field | Description | |---|---| | `Dcl-Pr IPI_LoadImage Ind ExtProc('IPI_LoadImage');` | Returns *OFF if an error occurs during processing, *ON otherwise. | | ` pImageDS LikeDS(IPI_ImageDS_t);` | Return parameter that contains the loaded image which can be used with other IPI subprocedures. | | ` pLoadImageDS LikeDS(IPI_LoadImageDS_t) Const;` | Controls how the image data is loaded and can be used to provide an IFS STMF to load data from. | | ` pImageData VarChar(16773100:4) Const Options(*Omit:*VarSize);` | May be used to pass image data | | ` pErrorDS LikeDS(IPI_ErrorDS_t) 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. | | `End-Pr;` | | ## Data Structures ### IPI_LoadImageDS_t | Field | Description | |---|---| | `Dcl-Ds IPI_LoadImageDS_t Qualified Template Inz;` | | | ` Base64Encoded Ind Inz(IPI_YES);` | **Default Value:** `IPI_YES` **Valid Values:** `IPI_YES`, `IPI_NO` | | ` Stmf VarChar(8192);` | Specifies a path to a STMF in the IFS where image data should be loaded from. | | ` InputCcsid Int(10) Inz(IPI_CCSID_JOB);` | **Default Value:** `IPI_CCSID_JOB` | | ` ImagePointer Pointer Inz(*Null);` | **Internal use only** | | ` ImagePointerLength Uns(10);` | **Internal use only** | | `End-Ds;` | | ### IPI_ImageDS_t | Field | Description | |---|---| | `Dcl-Ds IPI_ImageDS_t Qualified Template Inz;` | | | ` Image Pointer Inz(*Null);` | **Internal use only** | | ` MaxSize Uns(10);` | **Internal use only** | | ` UsedSize Uns(10);` | **Internal use only** | | ` Format Char(8);` | **Internal use only** | | `End-Ds;` | | ### IPI_ErrorDS_t | Field | Description | |---|---| | `Dcl-Ds IPI_ErrorDS_t Qualified Template Inz;` | | | ` Subproc VarChar(132);` | Subprocedure which received error | | ` MessageCode Char(7);` | Message ID of error message | | ` Message VarChar(1024);` | Error message text | | `End-Ds;` | |