Get ImageId From DecalId

Hey, is there any way to get the ImageId from a DecalId using scripts / code?

There’s a Texture property for decals that you can access that will give you the image id

Example:

local Decal; --Set the decal to this

local ImageID = Decal.Texture --Full id string so like rbxassetid://0
local ImageID2 = Decal.Texture:Split("\\")[2] --Number only part of the ID

1 Like

There’s a problem, im looking for a ImageId, i used roblox open cloud to upload a image but you cant get a ImageId so i can only obtain the DecalId.

If I may ask, what are you using this for?

Btw you can convert it like this:
DecalId = rbxassetid://0
ImageId = rbxthumb://type=Asset&w=420&h=420&id=0

You can fetch an image via asset delivery using the following API:

https://assetdelivery.roblox.com/v1/asset/?id=[DECAL_ID_HERE]

You will not be able to make this call directly via HttpService in-game and will need to find a proxy server to route it through.

If what you’ve provided is a DecalId, then what you’ll get back is an XML file, and you’ll need to parse the ImageId from that. If what you’ve provided is an ImageId, the you’ll get the raw PNG, which you won’t be able to display, but you’ll know what you provided already was an ImageId, so you can just use that. I’ve also gotten responses that point to the actual content that I then have to follow to get what I’m looking for, but that doesn’t happen when I enter the link into my browser, so it might be automatically redirecting. Not sure. This area isn’t my forte, but it’s what we do in one of my games.

Here’s an example of an XML response I received from entering DecalId 18150546575 (a test image I’ve uploaded previously).

<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
  <External>null</External>
  <External>nil</External>
  <Item class="Decal" referent="RBX0">
    <Properties>
      <token name="Face">5</token>
      <string name="Name">Decal</string>
      <float name="Shiny">20</float>
      <float name="Specular">0</float>
      <Content name="Texture">
        <url>http://www.roblox.com/asset/?id=18150546516</url>
      </Content>
      <bool name="archivable">true</bool>
    </Properties>
  </Item>
</roblox>

You can see in this response the <url> tag containing the actual image link. That’s what you’ll want to use on any Decals or ImageLabels or what have you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.