Class
ImageLabel
A 2D user interface element that displays a single non-interactive image.
An ImageLabel renders a rectangle, like a Frame does, with an
image asset. The display of the image can be manipulated through the
ImageColor3 and
ImageTransparency properties. To display
only the image and hide the rectangle, set
GuiObject.BackgroundTransparency to 1.
Advanced ImageLabel usage includes:
Tiled images can be created by setting
ScaleTypetoScaleType.Tile, thenTileSizeto the size of rendered tiles.9-slice images can be created by setting
ScaleTypetoScaleType.Slice, thenSliceCenterto the center area of the 9‑slice image.Sprite sheets can be implemented through the use of
ImageRectOffsetandImageRectSize. Packing multiple images into one and using this property can make your experience's image assets load much quicker, especially if you use many small icons in your GUIs.
Properties 12#
ImageContentId | The image content displayed by the UI element. Reads and writes to
ImageContent.ReadSafe |
ImageColor3Color3 | Determines how a rendered image will be colorized.ReadSafe |
ImageContentContent | The image content displayed by the UI element. Supports
asset URIs and
EditableImage objects.ReadSafe |
ImageRectOffsetVector2 | The offset in pixels of the sub-area of an image to be displayed.ReadSafe |
ImageRectSizeVector2 | Determines the size in pixels of the sub-area of an image to be displayed.ReadSafe |
ImageTransparencyfloat | Determines the transparency of the rendered image.ReadSafe |
IsLoadedboolean | Indicates whether the image has finished loading from Roblox.ReadSafeReadOnlyNotReplicated |
ResampleModeResamplerMode | Selects the image resampling mode for the label.ReadSafe |
ScaleTypeScaleType | Determines how an image will scale if displayed in a UI element whose size differs from the source image.ReadSafe |
SliceCenterRect | Sets the slice boundaries of a 9-sliced image.ReadSafe |
SliceScalefloat | Scales the 9-slice edges by the specified ratio.ReadSafe |
TileSizeUDim2 | Sets the tiling size of the ImageLabel.ReadSafe |
Image: ContentId#
ReadSafe
This property is a content-type property that should hold the asset ID of
a decal or image uploaded to Roblox. It functions identically to
Decal.Texture with regards to loading the image from Roblox. The
rendered image can be modified using
ImageColor3 and
ImageTransparency.
ImageColor3: Color3#
ReadSafe
This property determines how an image is colorized. When set to white, no colorization occurs. This property is very useful for reusing image assets; if the source image is completely white with transparency, you can set the entire color of the image at once with this property.
ImageContent: Content#
ReadSafe
This property should hold an
asset URI or a reference
to an EditableImage object.
The asset URI can reference a decal or image uploaded to Roblox. It
functions identically to Decal.Texture with regards to loading the
image.
The rendered image will be colorized using
ImageButton.ImageColor3. It is possible to make the image render
as tiled, scaled to fit, or 9-sliced, by adjusting the
ImageButton.ScaleType property.
ImageRectOffset: Vector2#
ReadSafe
Allows the partial display of an image in conjunction with
ImageRectSize. This property determines
the pixel offset (from the top-left) of the image area to be displayed.
ImageRectSize: Vector2#
ReadSafe
Allows the partial display of an image in conjunction with
ImageRectOffset. This property
determines the pixel size of the image area to be displayed. If either
dimension is set to 0, the entire image is displayed instead.
ImageTransparency: float#
ReadSafe
This property determines the alpha of a UI element's rendered image. A
value of 0 is completely opaque and a value of 1 is completely
transparent (invisible).
IsLoaded: boolean#
ReadOnlyNotReplicatedReadSafe
This property indicates if the ImageLabel.Image property has
finished loading from Roblox. Images declined by moderation will never
load.
ResampleMode: ResamplerMode#
ReadSafe
Determines how the image looks when it is scaled. By default, the image
smooths out texturing when displayed on the screen larger or smaller than
its size in texture memory. When set to
Enum.ResamplerMode.Pixelated, the image
preserves the sharp edges of pixels.
ScaleType: ScaleType#
ReadSafe
This property determines in what way an ImageLabel.Image is
rendered when the UI element's absolute size differs from the source
image's size.
By default, this property is ScaleType.Stretch which will simply
stretch/compact the image dimensions so it fits the UI element's space
exactly. Since transparent pixels are set to black when uploading to
Roblox, transparent images should apply alpha blending to avoid a blackish
outline around scaled images.
For ScaleType.Slice, the SliceCenter
property will be revealed in the
Properties window. This is for nine-slice
UI: when scaling up, the corners will remain the source image size. The
edges of the image will stretch to the width/height of the image. Finally,
the center of the image will stretch to fill the center area of the image.
Finally, for ScaleType.Tile, the
TileSize property will be revealed in the
Properties window. This is for tiled
images, where the size of each image tile is determined by the
TileSize property.
SliceCenter: Rect#
ReadSafe
This property sets the slice boundaries of a 9-sliced image when
ScaleType is set to
Enum.ScaleType.Slice. Please note that this
property is only visible in the
Properties window under this condition.
To learn more about 9-slice images, see UI 9 Slice Design.
SliceScale: float#
ReadSafe
Scales the 9-slice edges by the specified ratio. This means that the edges
around the 9-slice will grow as if you'd uploaded a new version of the
texture upscaled. Defaults to 1.0.
See also ScaleType,
SliceCenter, and
SliceScale.
TileSize: UDim2#
ReadSafe
This property sets the tiling size of the ImageLabel with a
default of
Datatype.UDim2.new(1, 0, 1, 0). Tiling
starts at the top-left corner of the image. This property is only active
if the ScaleType for the ImageLabel
is set to ScaleType.Tile.
Inherited members#
Inherited from GuiObject 51
Properties (30)
Active, AnchorPoint, AutomaticSize, BackgroundColor, BackgroundColor3, BackgroundTransparency, BorderColor, BorderColor3, BorderMode, BorderSizePixel, ClipsDescendants, Draggable, GuiState, InputSink, Interactable, LayoutOrder, NextSelectionDown, NextSelectionLeft, NextSelectionRight, NextSelectionUp, Position, Rotation, Selectable, SelectionImageObject, SelectionOrder, Size, SizeConstraint, Transparency, Visible, ZIndex
Methods (3)
Inherited from GuiBase2d 12
Properties (11)
AbsolutePosition, AbsoluteRotation, AbsoluteSize, AutoLocalize, Localize, RootLocalizationTable, SelectionBehaviorDown, SelectionBehaviorLeft, SelectionBehaviorRight, SelectionBehaviorUp, SelectionGroup
Events (1)
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild