Getting image id from decal id?

I’ve tried finding a way in old posts, however they all contain solutions that either work in plugins, either result in low quality (https://www.roblox.com/asset-thumbnail/image). Is there a way to efficiently get the image id from decal id, without losing any quality or doing 50+ requests? Something like f3x btools did (http://f3xteam.com/bt/getDecalImageID/)

I believe a member of the Roblox staff gave the following solution, or one that’s similar.

You can use InsertService:LoadAsset() to create a Model that holds the Decal, then get the texture of that Decaland delete the Model afterwards, since you don’t need it anymore.
Here’s an example snippet:

local InsertService = game:GetService("InsertService")

local decalModel = InsertService:LoadAsset(--[[Decal ID]])
local decal = decalModel:FindFirstChildOfClass("Decal")
local imageId = decal.Texture

decalModel:Destroy()

Sorry if this is not what you want.

Running this code on roblox servers results in an error. Used the first image in marketplace to test.

EDIT: I need to get the decal from user input, not owned by me.

According to the documentations, the asset must be owned or created by the creator of the game or Roblox.

Also, it is good practice to wrap the InsertService:LoadAsset() method in a pcall, because it can error.

Example snippet inspired by the documentations:

local success, model = pcall(InsertService.LoadAsset, InsertService, id)

if success then
    -- Code here.
end

Maybe you can use InsertService:GetUserSets(), look for the asset that has the same ID as the one provided by the player, then get the icon ID of that decal. I am not completely sure, and I can’t test this right now, but the decal’s icon might be the same as its texture.

This function does yield, and probably isn’t as efficient.
InsertService:GetUserSets().
Hopefully someone else can help you, too.