EditableImage
Instance which allows for the runtime creation and manipulation of images.
Memory category | Instances |
---|
Member index 13
Removed member index 8
History | Member | |
---|---|---|
648 | Copy(min: Vector2, max: Vector2): EditableImage | |
648 | Crop(min: Vector2, max: Vector2): null | |
650 | DrawProjectionImage(mesh: Object, projection: Dictionary, brushConfig: Dictionary): null | |
649 | GetContent(): Content | |
648 | ReadPixels(position: Vector2, size: Vector2): Array | |
648 | Resize(size: Vector2): null | |
648 | Rotate(degrees: float, changeSize: bool): null | |
648 | WritePixels(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
- 650 Remove DrawProjectionImage
- 650 Add DrawImageTransformed
- 650 Add DrawImageProjected
- 649 Remove GetContent
- 649 Add Destroy
- 649 Change CanSave of from false to true
- 649 Change CanLoad of from false to true
- 649 Change Tags of EditableImage from [] to [NotCreatable]
- 648 Remove WritePixels
- 648 Remove Rotate
- 648 Remove Resize
- 648 Remove ReadPixels
- 648 Add GetContent
- 648 Change Parameters of DrawProjectionImage from (mesh: EditableMesh, projection: Dictionary, brushConfig: Dictionary) to (mesh: Object, projection: Dictionary, brushConfig: Dictionary)
- 648 Change Parameters of DrawImage from (position: Vector2, image: EditableImage, combineType: ImageCombineType) to (position: Vector2, image: Object, combineType: ImageCombineType)
- 648 Remove Crop
- 648 Remove Copy
- 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
- 648 Change Default of from false to __api_dump_failed_to_create_class__
- 648 Change Default of from to __api_dump_failed_to_create_class__
- 648 Change Superclass of EditableImage from Instance to Object
- 644 Add DrawTriangle
- 640 Add WritePixelsBuffer
- 640 Add ReadPixelsBuffer
- 636 Add
- 632 Change Parameters of DrawRectangle from (position: Vector2, size: Vector2, color: Color3, transparency: float) to (position: Vector2, size: Vector2, color: Color3, transparency: float, combineType: ImageCombineType)
- 632 Change Parameters of DrawLine from (p1: Vector2, p2: Vector2, color: Color3, transparency: float) to (p1: Vector2, p2: Vector2, color: Color3, transparency: float, combineType: ImageCombineType)
- 632 Change Parameters of DrawCircle from (center: Vector2, radius: int, color: Color3, transparency: float) to (center: Vector2, radius: int, color: Color3, transparency: float, combineType: ImageCombineType)
- 623 Change Tags of EditableImage from [NotReplicated] to []
- 616 Add DrawProjectionImage
- 604 Change Tags of EditableImage from [] to [NotReplicated]
- 603 Change Tags of EditableImage from [NotReplicated] to []
- 604 Change Tags of EditableImage from [] to [NotReplicated]
- 601 Add WritePixels
- 601 Add Rotate
- 601 Add Resize
- 601 Add ReadPixels
- 601 Add DrawRectangle
- 601 Add DrawLine
- 601 Add DrawImage
- 601 Add DrawCircle
- 601 Add Crop
- 601 Add Copy
- 601 Add Size
- 601 Add
- 601 Add EditableImage
Members 13
Destroy
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Destroys the contents of the image, immediately reclaiming used memory.
Thread safety | Unsafe |
---|
DrawCircle
Parameters (5) | ||
---|---|---|
center | Vector2 | |
radius | int | |
color | Color3 | |
transparency | float | |
combineType | ImageCombineType | |
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.
Thread safety | Unsafe |
---|
History 2
- 632 Change Parameters of DrawCircle from (center: Vector2, radius: int, color: Color3, transparency: float) to (center: Vector2, radius: int, color: Color3, transparency: float, combineType: ImageCombineType)
- 601 Add DrawCircle
DrawImage
Parameters (3) | ||
---|---|---|
position | Vector2 | |
image | Object | |
combineType | ImageCombineType | |
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.
Thread safety | Unsafe |
---|
History 2
- 648 Change Parameters of DrawImage from (position: Vector2, image: EditableImage, combineType: ImageCombineType) to (position: Vector2, image: Object, combineType: ImageCombineType)
- 601 Add DrawImage
DrawImageProjected
Parameters (3) | ||
---|---|---|
mesh | Object | |
projection | Dictionary | |
brushConfig | Dictionary | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
History 1
DrawImageTransformed
Parameters (5) | ||
---|---|---|
position | Vector2 | |
scale | Vector2 | |
rotation | float | |
image | Object | |
options | Dictionary? | |
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.
Thread safety | Unsafe |
---|
History 1
DrawLine
Parameters (5) | ||
---|---|---|
p1 | Vector2 | |
p2 | Vector2 | |
color | Color3 | |
transparency | float | |
combineType | ImageCombineType | |
Returns (1) | ||
null |
Draws an anti-aliased line on the EditableImage one pixel thick between the two provided points.
Thread safety | Unsafe |
---|
DrawRectangle
Parameters (5) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
color | Color3 | |
transparency | float | |
combineType | ImageCombineType | |
Returns (1) | ||
null |
Draws a rectangle on the EditableImage of the given size at the given top-left position.
Thread safety | Unsafe |
---|
History 2
- 632 Change Parameters of DrawRectangle from (position: Vector2, size: Vector2, color: Color3, transparency: float) to (position: Vector2, size: Vector2, color: Color3, transparency: float, combineType: ImageCombineType)
- 601 Add DrawRectangle
DrawTriangle
Parameters (5) | ||
---|---|---|
p1 | Vector2 | |
p2 | Vector2 | |
p3 | Vector2 | |
color | Color3 | |
transparency | float | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 644 Add DrawTriangle
ReadPixelsBuffer
Parameters (2) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
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.
Thread safety | Safe |
---|
History 1
- 640 Add ReadPixelsBuffer
Size
Type | Default | |
---|---|---|
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().
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false/true |
WritePixelsBuffer
Parameters (3) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
buffer | buffer | |
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.
Thread safety | Unsafe |
---|
History 1
- 640 Add WritePixelsBuffer
Removed members 8
Copy
Parameters (2) | ||
---|---|---|
min | Vector2 | |
max | Vector2 | |
Returns (1) | ||
EditableImage |
Thread safety | Unsafe |
---|
Crop
Parameters (2) | ||
---|---|---|
min | Vector2 | |
max | Vector2 | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
DrawProjectionImage
Parameters (3) | ||
---|---|---|
mesh | Object | |
projection | Dictionary | |
brushConfig | Dictionary | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
History 3
- 650 Remove DrawProjectionImage
- 648 Change Parameters of DrawProjectionImage from (mesh: EditableMesh, projection: Dictionary, brushConfig: Dictionary) to (mesh: Object, projection: Dictionary, brushConfig: Dictionary)
- 616 Add DrawProjectionImage
GetContent
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Content |
Thread safety | Unsafe |
---|
History 2
- 649 Remove GetContent
- 648 Add GetContent
ReadPixels
Parameters (2) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
Returns (1) | ||
Array |
Thread safety | Safe |
---|
History 2
- 648 Remove ReadPixels
- 601 Add ReadPixels
Resize
Parameters (1) | ||
---|---|---|
size | Vector2 | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
Rotate
Parameters (2) | ||
---|---|---|
degrees | float | |
changeSize | bool | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
WritePixels
Parameters (3) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
pixels | Array | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
History 2
- 648 Remove WritePixels
- 601 Add WritePixels