It's Impossible to Get an Image ID From a Decal ID

Whoops, I shouldn’t have used the word “method” as it has multiple meanings here. I understand that the API methods are well documented, I meant the method (as in technique/solution) that you shared uses those APIs in a clever way that doesn’t seem to be mentioned anywhere and is only obvious if you already know about it.


After switching the -n technique to your given InsertService technique, I was met with this:

InsertService cannot be used to load assets from the client

The workaround you provided doesn’t work on the client, which is extremely inconvenient.

After reworking it to be on the server, I found that this suggested workaround is still does not work, since InsertService cannot insert assets that you don’t own.

HTTP 403 (Forbidden)

An asset loaded by this function must be created or owned by either the game creator or Roblox. (Source)

The goal in our aforementioned use cases is to allow players to use custom images that they own, so this completely defeats the purpose.


So, unfortunately, my original post’s method is still the only currently available hack.

11 Likes

To add onto this, we shouldn’t have to ask users to open their inventory for us to grab the image that we need. The current method supplied depends on us making sure the client’s inventory is available for us to view, which seems really sketchy if you ask your players to open their inventory. A solution that provides the image without this hassle would again be a quality of life feature that we need.

5 Likes

Even if they make the decal public, the InsertService call will still throw an error.
The documentation is correct in stating that the asset must be owned by you or Roblox.

Here’s a simple test to prove that. This decal, kindly provided by @PeZsmistic, is public.
https://www.roblox.com/library/5376310957/logo

local InsertService = game:GetService("InsertService")
local MarketplaceService = game:GetService("MarketplaceService")

local DecalID = "5376310957"

local AssetInfo = MarketplaceService:GetProductInfo(DecalID, Enum.InfoType.Asset)

print("Public =", AssetInfo.IsPublicDomain)
print("IsDecal =", AssetInfo.AssetTypeId == 13)

local Decal = InsertService:LoadAsset(DecalID):FindFirstChildWhichIsA("Decal") -- ERRORS 403
local ImageID = Decal.Texture

image

14 Likes

I believe this needs to be an API member as well.

I would say “I’m surprised this was suggested so late”, but you consider how these assets are created, and anything earlier than the past three years or so didn’t need this API because it was as easy as ID-1, simply because asset uploads were less frequent than they are today. This worked beautifully for years but these days it’s just not viable anymore with how many people are uploading content onto the platform.

This has been a huge issue for me as well. I flat out don’t even know how to automate this, and have always resorted to just manually grabbing the image ID for my assets and baking them into my scripts as hardcoded strings. User input has always relied on the user just getting the ID on their own.

I think something like a marketplace API call would be the best because it doesn’t rely on having a script insert assets into your game, it doesn’t require you to own the ID as per the limitations of InsertService, and it’s straightforward.

If anything, I’d vouch for it being a member of ContentProvider because that seems more mnemonic in my opinion (ContentProvider:GetImageFromDecalAsync(decal) makes more sense to me than MarketplaceService:GetImageFromDecalAsync(decal) does, for example)

7 Likes

For anyone wanting a direct URL that’s valid with textures/image inputs ingame in realtime without needing to worry about LoadAsset, you can input this at the cost of image quality until they make an actual function for it

"https://www.roblox.com/asset-thumbnail/image?assetId="..DecalID.."&width=420&height=420&format=png"

Since it’s technically grabbing the thumbnail of the asset, it should work with model/audio/video/mesh/plugin thumbnails as well. Not really useful for needing to get an actual image ID for studio purposes but works pretty well for having players input decal IDs for custom images etc.

17 Likes

We still need this :frowning:

For example, I’d like to allow users to use their own decal in a game. There is no user-friendly way for someone to get the image ID from the decal ID. The average Roblox player wouldn’t know how to do this.

16 Likes

This is frustratingly annoying, this really needs to be a built in feature that works with other players assets as well so we don’t have to do some hacky workaround to get the imageID.

5 Likes

Bumping this again because I seriously need this for something right now.

(seriously, all image based assets (decals, shirts, pants etc.) create rbxmx files housing the image, how hard is it to add this?)

4 Likes

I agree this is necessary. I have several use cases for user selected images in my game. Most users have no clue how to get the image id, and Roblox only shows the Decal Id in their inventory. I currently use a proxy API and the assetdelivery API to retrieve the image id if decal id is supplied. This is costly since there’s a finite 500/min budget and forces me to rate-limit changes. Adding this method should be trivial.

Side note, it’d be great if we could also get properties or a method to get the width & height of an image for determining aspect ratios. I have to use HttpService to pull in the image data and parse for them. Not optimal at all when this info is known by the engine.

6 Likes