Roblox UtilitiesDevlHub Roblox Documentation

Class

ImageButton

Inherits
GuiButton › GuiObject › GuiBase2d › GuiBase › Instance › Object
Memory category
Gui

A 2D user interface element that displays an interactive image.

An ImageButton behaves similarly to an ImageLabel in regards to rendering, with the additional behaviors of a GuiButton.

Properties 16#

HoverImageContentIdA texture ID that will be used when the ImageButton is being hovered.ReadSafe
HoverImageContentContentThe image content that will be used when the ImageButton is being hovered. Only supports asset URIs.ReadSafe
ImageContentIdThe image content displayed by the ImageButton element. Reads and writes to ImageContent.ReadSafe
ImageColor3Color3Determines how a rendered image will be colorized.ReadSafe
ImageContentContentThe image content displayed by the UI element. Supports asset URIs and EditableImage objects.ReadSafe
ImageRectOffsetVector2The offset in pixels of the sub-area of an image to be displayed.ReadSafe
ImageRectSizeVector2Determines the size in pixels of the sub-area of an image to be displayed.ReadSafe
ImageTransparencyfloatDetermines the transparency of the rendered image.ReadSafe
IsLoadedbooleanIndicates whether the Image has finished loading from the Roblox website.ReadSafeReadOnlyNotReplicated
PressedImageContentIdA texture ID that will be used when an ImageButton is being pressed.ReadSafe
PressedImageContentContentThe image content that will be used when an ImageButton is being pressed. Only supports asset URIs.ReadSafe
ResampleModeResamplerModeSelects the image resampling mode for the button.ReadSafe
ScaleTypeScaleTypeDetermines how an image will scale if displayed in a UI element whose size differs from the source image.ReadSafe
SliceCenterRectSets the slice boundaries of a 9-sliced image.ReadSafe
SliceScalefloatScales the 9-slice edges by the specified ratio.ReadSafe
TileSizeUDim2Sets the tiling scale of the ImageButton.ReadSafe

HoverImage: ContentId#

ReadSafe

A texture ID that will be used when the ImageButton is being hovered.

HoverImageContent: Content#

ReadSafe

An image-type Content that can be set as an ImageButton property. When the button is hovered, it will render this image. Only asset URIs are supported for this property.

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 will be colorized using ImageColor3.

Note that it is possible to make the image render as tiled, scaled to fit, or 9-sliced by adjusting the ScaleType property.

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 ImageColor3. It is possible to make the image render as tiled, scaled to fit, or 9‑sliced by adjusting the ScaleType property.

ImageRectOffset: Vector2#

ReadSafe

This property determines the pixel offset (from the top-left) of the image area to be displayed, allowing for the partial display of an image in conjunction with ImageRectSize.

ImageRectSize: Vector2#

ReadSafe

This property determines the pixel size of the image area to be displayed, allowing for the partial display of an image in conjunction with ImageRectOffset. If either dimension is set to 0, the entire image is displayed instead.

ImageTransparency: float#

ReadSafe

This property determines the alpha of the element's rendered image. A value of 0 is completely opaque and a value of 1 is completely transparent (invisible). This property behaves similarly to GuiObject.BackgroundTransparency or BasePart.Transparency.

If you disable image rendering by setting ImageTransparency to 1, it will result in a plain rectangle that can be used as a button. However, it may be better to use a blank TextButton instead.

IsLoaded: boolean#

ReadOnlyNotReplicatedReadSafe

This property indicates if the Image property has finished loading from Roblox. Images declined by moderation will never load.

PressedImage: ContentId#

ReadSafe

A texture ID that can be set as an ImageButton property. When the button is pressed, it will render this image.

PressedImageContent: Content#

ReadSafe

An image-type Content that can be set as an ImageButton property. When the button is pressed, it will render this image. Only asset URIs are supported for this property.

ResampleMode: ResamplerMode#

ReadSafe

Determines how the image looks when it is scaled. By default, the image smooths out the texture when displayed either larger or smaller than its size in texture memory. In contrast, Enum.ResamplerMode.Pixelated preserves the sharp edges of the image pixels.

ScaleType: ScaleType#

ReadSafe

This property determines in what way the Image property is rendered when the UI element's absolute size differs from the source image's size.

By default, this property is Enum.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, 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. To learn more about 9‑sliced images, see UI 9‑Slice Design.

For ScaleType.Tile, 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.

To learn more about 9‑sliced 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.

As a multiplier for the borders of a 9-slice, it is useful for reusing one rounded corner image for multiple radii.

See also ScaleType which determines how an image will scale if displayed in a UI element whose size differs from the source image.

TileSize: UDim2#

ReadSafe

Sets the tiling size of the ImageButton starting at the upper-left corner of the image. The default UDim2 values are 1, 0, 1, 0; the scale components of the UDim2 will scale the tile based on the size of the ImageButton while the offset components are in raw pixels. For example, a scale of 0.5 means the tile will be half the size of the ImageButton in the corresponding axis.

This property is only active if the ScaleType property is set to ScaleType.Tile.

Inherited members#

Inherited from GuiButton 14
Inherited from GuiObject 51
Inherited from GuiBase2d 12
Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed