Does inserting the decal and reading its ID not work? This is what we do internally for the Properties widget when an assetId is pasted in. For Lua it would look something like
local InsertService = game:GetService("InsertService")
local MarketplaceService = game:GetService("MarketplaceService")
function getImageIdFromDecal(decalId)
local assetInfo = MarketplaceService:GetProductInfo(decalId, Enum.InfoType.Asset)
assert(assetInfo.IsPublicDomain)
assert(assetInfo.AssetTypeId == Enum.AssetType.Decal.Value)
local decal = InsertService:LoadAsset(decalId):FindFirstChildWhichIsA("Decal")
return decal.Texture
end
print(getImageIdFromDecal(3339338289))
This is also likely what the requested API would do behind the scenes.