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

Clearly there’s metadata somewhere in a decal asset that links it to the image ID. I agree that this would be great to have without needing to go through both MarketplaceService and InsertService.

8 Likes

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.

16 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.

6 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

19 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)

9 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.

31 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.

25 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.

6 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?)

8 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.

10 Likes

Bump

Bumping this thread because I’m running into an issue utilizing Open Cloud and external applications now with the inability to get image ids from decal asset ids.

I’m externally editing rbxmx files and directly inserting ids into models, however, I cannot use the decal asset ids, i have to use the decal image ids, which do not automatically get converted when the model is imported.

Using this for surface appearance importing automation.

Also on a side note, Open Cloud’s mesh upload does not allow you to directly get the mesh id either, you get given the model asset id because ‘fbx meshes’ are uploaded under the Models tab.

EDIT: yes I have looked through the Open Cloud APIs and available APIs in webpoints; they do not provide the image id directly and only provide the asset id.

3 Likes

Still needed feature. For a game I develop in which users are supposed to be able to put their own images in-game, currently we do not have any solution as all the potential solutions seem to be too hacky. It continually causes confusion for our players as the average player is not experienced enough with Roblox that they know that there is a difference between decals and images, and the process of having to get the image id from a decal yourself. And if I remember correctly, for a long time the only or the easiest way to upload something as just a generic image was to upload it as a decal through the website.
InsertService, as others have stated before, is inadequate because of the restrictions on the creators of an asset to be inserted into the game (why can’t this be disabled anyways?). Otherwise, the best solution appears to be either to use external Roblox API’s which are not accessible by a Roblox server and require an external server or proxy as Cuyler hinted at (because Roblox afaik prevents accessing any said APIs from a server even when they may provide better functionality than is available through lua APIs, and of course with more effort anyone can end up just using proxies anyway so it is a mystery why this is even the case), or trying to use the thumbnail image which will be low resolution and non-suitable for anything more than a small display or icon.

3 Likes

Could I ask what parameters you use for the decal asset id → image id?


1 Like

Bump.
I’m doing something very similar to spook here above with out of studio tools for my development team and the fact that there isn’t a simple to find API to convert asset id to image id is baffling me.
This is an absolute must have that should of been implemented yesterday.

I’ve had to use decals to to bulk import textures for surface materials in the past and that was a massive pain but was at least possible. I cant continue with my current task. I have wasted massive amounts of time. For a completely cloud based platform, I shouldn’t have to use hacky methods to do this even within roblox studio.

Sorry if this has come of a bit aggressive its not my intention to be a pain but this is a feature I’ve needed more than once and I’m not alone.
There needs to be a simple to use API to convert between all the different needed types of ids.
I didn’t expect something like this to be a roadblock when there are features in Roblox like surface appearance that only take certain id types.

1 Like

IIRC InsertService:LoadAsset can be used to get the image id from the decal id.

1 Like

why do images and decals have separate asset types in the first place? i’ve never understood the necessity of having a dedicated asset type for decals, as they’re nothing more than images in the first place…

5 Likes

Decals and Images should just be merged together at this point. There’s no point in separating them.

6 Likes

This only works for certain assets, though, like those owned by Roblox or the place/group owner. In my case, players can use custom cursors, which third parties almost always own. This method would not work for me as it would throw out an “Asset is not trusted for this place” error.

Not externally accessible without having a studio open + localhost system implemented

Treating this like audio AssetIds seems to be an ideal start to me, with the same level of configurations offering public or private uploads and monetization the same.