Model compatibility with ImageLabels

Hi there, I’m working on a game that requires me to use InsertService to collect Accessory thumbnails and I was wondering if there was a way to make these models accessible with ImageLabels because I’d rather not have to use ViewportFrames.

Now while I know it says that the image has to be a decal (shown below,) I’ve seen other games accomplish this which makes me wonder if it’s still possible to do so.

After reading through the documentation and trying a variety of different ways to try to get it to load I’ve had no luck so far. If anyone could help me out with this I’d greatly appreciate it.

1 Like

Very easy way to do this!
There’s an endpoint you can use, and you can set the ImageLabel’s Image directly to this.
The endpoint is https://www.roblox.com/asset-thumbnail/image?assetID=00000000&width=420&height=420&format=png, and you can make a function to do this for you.

local function assetIdToImage( id: number )
	return string.format( "https://www.roblox.com/asset-thumbnail/image?assetID=%.f&width=420&height=420&format=png", id )
end

imageLabel.Image = assetIdToImage( 00000000 ) -- the asset id
2 Likes

sounds like you’re looking for rbxthumb://:

there’s a few more thumbnail sizes than they advertise in the table on that page too. take a look at the “size” drop-down on this page of the thumbnail API docs:

https://thumbnails.roblox.com/docs#!/Assets/get_v1_assets

note that not all sizes are guaranteed to work with every asset type. just play around bc it’s going to be a bit of trial and error

you can combine it with the function suggested above to make it easier to reuse across scripts. add a second parameter if you want to enable an optional thumbnail size too:

local function assetIdToImage(id: number, width: number, height: number): string
  width = width or 420
  height = height or width

  return string.format("rbxthumb://type=Asset&id=%.f&w=%.f&h=%.f", id, width, height)
end

imageLabel.Image = assetIdToImage(1818) -- asset 1818, w420 (default), h420 (default)
imageLabel.Image = assetIdToImage(1818, 768, 432) -- w768, h432
imageLabel.Image = assetIdToImage(1818, 720) -- w720, h720
2 Likes

Thanks for the solutions, I’m gonna test these out real quick and I’ll mark this as solved if it works!

Edit: Works perfectly! Thanks for the help!

1 Like