# CreateMemblockFromImage

## Description

Creates a memblock from a loaded image, atlas sub images are not supported. The image must exist and is unaffected by this command. The first 4 bytes of the memlbock store the image width, the next 4 bytes store the image height, the next 4 bytes store the bit depth, currently this will always be 32. After that the raw image data begins in the format RGBA, with each component stored in a single byte, so each pixel takes up 4 bytes. The size of the image data can be calculated by width*height*4 bytes (for now bit depth can be assumed to be 32 bits = 4 bytes). Note that due to little endian format reading the image data with bytes will return offsets 0=R, 1=G, 2=B, 3=A, but reading them all as a single integer will produce a value with A as the most significant byte, followed by B, then G, then R as the least significant byte. The pixel data starts in the top left corner of the image an proceeds left to right then top to bottom resulting in the image being stored as a sequence of rows ending in the bottom right corner. Returns an ID that can be used to reference this memblock in other commands.

## Definition

integer CreateMemblockFromImage( imageID )

UINT agk::CreateMemblockFromImage( UINT imageID )

CreateMemblockFromImage( memID, imageID )

void agk::CreateMemblockFromImage( UINT memID, UINT imageID )

## Parameters

- imageID - The ID of the image to read.
- memID - The ID of the memblock to create.