Reference API Roblox

Engine API

Website

Related

Reference API Roblox

EditableImage

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

This class is not creatable. Instances of this class cannot be created with Instance.new.
Tags: [NotCreatable]

Member index 13

HistoryMember
648Size: Vector2
649Destroy(): null
632DrawCircle(center: Vector2, radius: int, color: Color3, transparency: float, combineType: ImageCombineType): null
648DrawImage(position: Vector2, image: Object, combineType: ImageCombineType): null
650DrawImageProjected(mesh: Object, projection: Dictionary, brushConfig: Dictionary): null
650DrawImageTransformed(position: Vector2, scale: Vector2, rotation: float, image: Object, options: Dictionary?): null
632DrawLine(p1: Vector2, p2: Vector2, color: Color3, transparency: float, combineType: ImageCombineType): null
632DrawRectangle(position: Vector2, size: Vector2, color: Color3, transparency: float, combineType: ImageCombineType): null
644DrawTriangle(p1: Vector2, p2: Vector2, p3: Vector2, color: Color3, transparency: float): null
640ReadPixelsBuffer(position: Vector2, size: Vector2): buffer
640WritePixelsBuffer(position: Vector2, size: Vector2, buffer: buffer): null
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Removed member index 8

HistoryMember
648Copy(min: Vector2, max: Vector2): EditableImage
648Crop(min: Vector2, max: Vector2): null
650DrawProjectionImage(mesh: Object, projection: Dictionary, brushConfig: Dictionary): null
649GetContent(): Content
648ReadPixels(position: Vector2, size: Vector2): Array
648Resize(size: Vector2): null
648Rotate(degrees: float, changeSize: bool): null
648WritePixels(position: Vector2, size: Vector2, pixels: Array): null

Description

EditableImage allows for the runtime creation and manipulation of images.

To create a blank EditableImage, use AssetService:CreateEditableImage(). To create an EditableImage from an existing image, use AssetService:CreateEditableImageAsync().

EditableImage can be used in any Content property which takes an image, such as ImageLabel.ImageContent or MeshPart.TextureContent. This is done by setting the content property to Content.fromObject(editableImage).

The EditableImage coordinate system is relative to the top left of the image:

  • Top-left: (0, 0)
  • Bottom-right: (Size.X - 1, Size.Y - 1)

When you use AssetService:PromptCreateAssetAsync() to publish an object that has a Content property which references an EditableImage, the editable image is published as an image and the property is set to a new asset ID.

Enabling EditableImage for Published Experiences

For security purposes, using EditableImage fails by default for published experiences. To enable the use of EditableImage, you must be 13+ age verified and ID verified. After you are verified, open Studio. Select File > Game Settings > Security and enable the Allow Mesh & Image APIs toggle. Remember to review the Terms of Use before enabling the toggle.

Permissions

To prevent misuse, AssetService:CreateEditableImageAsync() only allows you to load and edit image assets:

  • That are owned by the creator of the experience (if the experience is owned by an individual).
  • That are owned by a group (if the experience is owned by the group).
  • That are owned by the logged in Studio user (if the place file has not yet been saved or published to Roblox).

The APIs throw an error if they are used to load an asset that does not meet the criteria above.

History 48

Members 13

Destroy

Parameters (0)
No parameters.
Returns (1)
null

Destroys the contents of the image, immediately reclaiming used memory.

History 1

DrawCircle

Parameters (5)
centerVector2
radiusint
colorColor3
transparencyfloat
combineTypeImageCombineType
Returns (1)
null

Draws a circle at the specified point on the EditableImage. If the circle is semi-transparent, it will be blended with the pixels behind it using source over blending.

History 2

DrawImage

Parameters (3)
positionVector2
imageObject
combineTypeImageCombineType
Returns (1)
null

Draws another EditableImage into this EditableImage at the given position. Positions outside the canvas bounds are allowed such that only part of the new image is drawn.

History 2

DrawImageProjected

Parameters (3)
meshObject
projectionDictionary
brushConfigDictionary
Returns (1)
null

History 1

DrawImageTransformed

Parameters (5)
positionVector2
scaleVector2
rotationfloat
imageObject
optionsDictionary?
Returns (1)
null

This method lets you draw an EditableImage into this EditableImage with transformations applied, such as scaling and rotation. The position parameter specifies where the pivot point of the source image will be placed on this image after transformations. Positions outside the canvas bounds are allowed such that only part of the new image is drawn.

History 1

DrawLine

Parameters (5)
p1Vector2
p2Vector2
colorColor3
transparencyfloat
combineTypeImageCombineType
Returns (1)
null

Draws an anti-aliased line on the EditableImage one pixel thick between the two provided points.

History 2

DrawRectangle

Parameters (5)
positionVector2
sizeVector2
colorColor3
transparencyfloat
combineTypeImageCombineType
Returns (1)
null

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

History 2

DrawTriangle

Parameters (5)
p1Vector2
p2Vector2
p3Vector2
colorColor3
transparencyfloat
Returns (1)
null

History 1

ReadPixelsBuffer

Parameters (2)
positionVector2
sizeVector2
Returns (1)
buffer

A version of ReadPixels() that returns a buffer instead of a table. Each number in the buffer is a single byte, while each number in the table is 4 bytes, making ReadPixelsBuffer() more memory-efficient than ReadPixels().

Note that this method uses alpha instead of transparency, unlike the EditableImage drawing methods.

This function has a custom internal state. It may behave in a non-standard way.

History 1

Tags: [CustomLuaState]

Size

TypeDefault
Vector2__api_dump_failed_to_create_class__

Size of the EditableImage in pixels. The maximum size is 1024×1024. An EditableImage cannot be resized; this property is read-only. In order to resize or crop an image, create a new EditableImage and use DrawImageTransformed() to transfer the contents; then call Destroy().

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 4

  • 648 Change Tags of Size from [] to [ReadOnly, NotReplicated]
  • 648 Change Default of Size from Vector2(512, 512) to Vector2(__api_dump_failed_to_create_class__)
  • 648 Change CanLoad of Size from true to false
  • 601 Add Size
Tags: [ReadOnly, NotReplicated]

WritePixelsBuffer

Parameters (3)
positionVector2
sizeVector2
bufferbuffer
Returns (1)
null

A version of WritePixels() that takes a buffer instead of a table. Each number in the buffer is a single byte, while each number in the table is 4 bytes, making WritePixelsBuffer() more memory-efficient than WritePixels().

Note that this method uses alpha instead of transparency, unlike the EditableImage drawing methods.

This function has a custom internal state. It may behave in a non-standard way.

History 1

Tags: [CustomLuaState]

Removed members 8

Copy

Parameters (2)
minVector2
maxVector2
Returns (1)
EditableImage

History 2

Crop

Parameters (2)
minVector2
maxVector2
Returns (1)
null

History 2

DrawProjectionImage

Parameters (3)
meshObject
projectionDictionary
brushConfigDictionary
Returns (1)
null

History 3

GetContent

Parameters (0)
No parameters.
Returns (1)
Content

History 2

ReadPixels

Parameters (2)
positionVector2
sizeVector2
Returns (1)
Array
This function has a custom internal state. It may behave in a non-standard way.

History 2

Tags: [CustomLuaState]

Resize

Parameters (1)
sizeVector2
Returns (1)
null

History 2

Rotate

Parameters (2)
degreesfloat
changeSizebool
Returns (1)
null

History 2

WritePixels

Parameters (3)
positionVector2
sizeVector2
pixelsArray
Returns (1)
null
This function has a custom internal state. It may behave in a non-standard way.

History 2

Tags: [CustomLuaState]

Settings