# CopyImage

## Description

Copys a portion of the given image into a new image. The x, y, width, height values are in pixels and represent the portion of the image you would like to copy into a new image. The new image with have the same size as the width and height values given. If an image already exists with the new ID given it must be deleted before calling this command. This is a slow command and should not be called every frame.

## Definition

CopyImage( newImage, fromImage, x, y, width, height )

void agk::CopyImage( UINT newImage, UINT fromImage, int x, int y, int width, int height )

integer CopyImage( fromImage, x, y, width, height )

UINT agk::CopyImage( UINT fromImage, int x, int y, int width, int height )

## Parameters

- newImage - The ID of the new image to create, this image must not exist
- fromImage - The ID of the image to copy
- x - The x coordinate of the top left corner of the box to copy
- y - The y coordinate of the top left corner of the box to copy
- width - The width of the box to copy
- height - The height of the box to copy