# EditableImage

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/EditableImage/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/EditableImage

Object which allows for the runtime creation and manipulation of images.

## Properties

### ImageData

```luau
EditableImage.ImageData: string
```

- Tags: Hidden, Not replicated, Not scriptable, Roblox engine security, Read capabilities: DynamicGeneration

### ImageHolder

```luau
EditableImage.ImageHolder: NetAssetRef
```

- Tags: Hidden, Not scriptable, Roblox engine security, Read capabilities: DynamicGeneration

### IsReplicatedCopy

```luau
EditableImage.IsReplicatedCopy: boolean
```

- Tags: Hidden, Not replicated, Not scriptable, Roblox engine security, Read capabilities: DynamicGeneration

### Size

```luau
EditableImage.Size: Vector2
```

- Tags: Read only, Capabilities: DynamicGeneration, Save only

Size of the [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) in pixels.

## Methods

### Destroy

```luau
EditableImage:Destroy()
```

- Tags: Capabilities: DynamicGeneration

Destroys the image contents and immediately reclaims the memory they use.

### DrawCircle

```luau
EditableImage:DrawCircle(center: Vector2, radius: number, color: Color3, transparency: number, combineType: Enum.ImageCombineType, antiAliasing: Enum.AntiAliasing? = Enum.AntiAliasing.Enabled)
```

- Tags: Capabilities: DynamicGeneration

Draws a circle at the specified point.

Parameters:

- `center`: Center of the circle, relative to the top-left corner of the [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md). Positions outside the canvas bounds are allowed.
- `radius`: Radius of the circle in pixels.
- `color`: Color of the circle.
- `transparency`: Transparency of the circle with 0 being fully opaque and 1 being fully transparent.
- `combineType`: How the drawn pixels (source) are combined with the existing pixels of this image (destination).
- `antiAliasing`: Determines whether anti-aliasing is applied to the circle. When set to `AntiAliasing.Enabled`, circle edges are soft. When set to `AntiAliasing.Disabled`, circle edges are hard.

### DrawImage

```luau
EditableImage:DrawImage(position: Vector2, image: EditableImage, combineType: Enum.ImageCombineType)
```

- Tags: Capabilities: DynamicGeneration

Draws another [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) into this [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) at the given position.

Parameters:

- `position`: Position at which the top-left corner of the source image will be drawn.
- `image`: The source [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) to draw into this [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md).
- `combineType`: How the pixels of the source image are combined with the existing pixels of this image (destination).

### DrawImageProjected

```luau
EditableImage:DrawImageProjected(projectionSource: Object, projection: { [string]: any }, brushConfig: { [string]: any })
```

- Tags: Capabilities: DynamicGeneration

Projects another [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) into an [`EditableMesh`](https://rapi.sleaze.dev/classes/EditableMesh.md) and stores the result on this [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md).

Parameters:

- `projection`: Projection configuration dictionary including the following key-value pairs:

- `Direction` ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) where the projector is facing.
- `Position` ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) as the position in local space with respect to the mesh.
- [`Size`](https://rapi.sleaze.dev/classes/EditableImage.md) ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) as the size of the projector.
- `Up` ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) as the up vector of the projector in local space with respect to the mesh.
- `brushConfig`: Brush configuration dictionary including the following key-value pairs:

- `AlphaBlendType` (`ImageAlphaType`) which determines how this projection will blend alpha values.
- `ColorBlendType` (`ImageCombineType`) which determines how this projection will blend color values.
- [`Decal`](https://rapi.sleaze.dev/classes/Decal.md) ([`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md)) as the image used for projection.
- `FadeAngle` (number) as the angle in degrees for the projection edges to start to fall off. The projection will be fully faded out at 90 degrees. An angle of 0 means fading starts immediately at 0 degrees and an angle of 90 means no fading but instead a hard edge at 90 degrees. An angle of 70 degrees would mean the projection starts to fade at 70 degrees and is fully faded out at 90 degrees.
- `BlendIntensity` (number) as the value between `0` and `1` which controls how much of the projection is blended into the resulting image.

### DrawImageTransformed

```luau
EditableImage:DrawImageTransformed(position: Vector2, scale: Vector2, rotation: number, image: EditableImage, options: { [string]: any }?)
```

- Tags: Capabilities: DynamicGeneration

Draws an image into this [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) with transformations including scaling and rotation, placing it at the specified position.

Parameters:

- `position`: Position in pixels where the pivot point of the source image will be placed on this image.
- `scale`: Scaling factors for the source image along the X and Y axes.
- `rotation`: The rotation angle in degrees, applied around the pivot point of the source image.
- `image`: The source [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) to be drawn into this image.
- `options`: Optional dictionary for additional configuration:

- `CombineType`: Specifies how the pixels of the source image blend with those of the destination. Default is `ImageCombineType.AlphaBlend`.
- `SamplingMode`: Specifies the sampling method (e.g. `Default` for bilinear or `Pixelated` for nearest neighbor). Default is `ResamplerMode.Default`.
- `PivotPoint`: Specifies the pivot point within the source image for scaling and rotation. Default is the center of the source image (i.e. `Size / 2`).

### DrawLine

```luau
EditableImage:DrawLine(p1: Vector2, p2: Vector2, color: Color3, transparency: number, combineType: Enum.ImageCombineType, antiAliasing: Enum.AntiAliasing? = Enum.AntiAliasing.Enabled)
```

- Tags: Capabilities: DynamicGeneration

Draws a line between two provided points.

Parameters:

- `p1`: Start point of the line.
- `p2`: End point of the line.
- `color`: Color of the line.
- `transparency`: Transparency of the line.
- `combineType`: How the drawn pixels (source) are combined with the existing pixels of this image (destination).
- `antiAliasing`: Determines whether anti-aliasing is applied to the line. When set to `AntiAliasing.Enabled`, line edges are soft. When set to `AntiAliasing.Disabled`, line edges are hard.

### DrawRectangle

```luau
EditableImage:DrawRectangle(position: Vector2, size: Vector2, color: Color3, transparency: number, combineType: Enum.ImageCombineType)
```

- Tags: Capabilities: DynamicGeneration

Draws a rectangle of the given size at the given top-left position.

Parameters:

- `position`: Position of the top-left of the rectangle. Unlike other drawing methods, this cannot be outside the canvas bounds of the [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md).
- `size`: Size of the rectangle to draw, in pixels.
- `color`: Color of the rectangle.
- `transparency`: Transparency of the rectangle.
- `combineType`: How the drawn pixels (source) are combined with the existing pixels of this image (destination).

### DrawTriangle

```luau
EditableImage:DrawTriangle(p1: Vector2, p2: Vector2, p3: Vector2, color: Color3, transparency: number)
```

- Tags: Roblox script security, Capabilities: DynamicGeneration

### ReadPixelsBuffer

```luau
EditableImage:ReadPixelsBuffer(position: Vector2, size: Vector2): buffer
```

- Tags: Custom Lua state, Thread safe, Capabilities: DynamicGeneration

Reads a rectangular region of pixels into a buffer.

Parameters:

- `position`: Top-left corner of the rectangular region of pixels to read.
- `size`: Size of the rectangular region of pixels to read.

Returns: Buffer where each pixel is represented by four bytes (red, green, blue and alpha respectively). The length of the buffer can be calculated as `X * Size.Y * 4` bytes.

### SampleImageProjected

```luau
EditableImage:SampleImageProjected(projectionSource: Object, sourceTexture: EditableImage, projectionConfig: { [string]: any }, brushConfig: { [string]: any })
```

- Tags: Capabilities: DynamicGeneration

Projects pixels from an [`EditableMesh`](https://rapi.sleaze.dev/classes/EditableMesh.md) texture into this [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md).

Parameters:

- `sourceTexture`: The [`EditableImage`](https://rapi.sleaze.dev/classes/EditableImage.md) from which pixels are sampled.
- `projectionConfig`: Projection configuration dictionary containing the following key-value pairs:

- `Direction` ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) where the projector is facing.
- `Position` ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) as the projector position in local space with respect to the mesh.
- [`Size`](https://rapi.sleaze.dev/classes/EditableImage.md) ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) as the size of the projector. The **X** and **Y** components specify its dimensions, while the **Z** component specifies the projection depth.
- `Up` ([`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md)) as the up vector of the projector in local space with respect to the mesh.
- `brushConfig`: Brush configuration dictionary containing the following key-value pairs:

- `AlphaBlendType` (`ImageAlphaType`) which determines how the sampled alpha values are blended.
- `ColorBlendType` (`ImageCombineType`) which determines how the sampled color values are blended.
- `FadeAngle` (number) as the angle in degrees at which the projection begins to fade based on the surface normal. A value of `180` applies no normal-angle fade.

### WritePixelsBuffer

```luau
EditableImage:WritePixelsBuffer(position: Vector2, size: Vector2, buffer: buffer)
```

- Tags: Custom Lua state, Capabilities: DynamicGeneration

Writes a rectangular region of pixels into the image.

Parameters:

- `position`: Top-left corner of the rectangular region to draw the pixels into.
- `size`: Size of the rectangular region of pixels to write.
- `buffer`: A buffer where each pixel is represented by four bytes (red, green, blue, and alpha respectively). The length of the buffer should be `X * Size.Y * 4` bytes.

## Inherited members

- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
