Getting Decal Image Url

Is it possible to use an ImageId (From decals) to get an image url so I can use it for things such as discord webhooks? If it is, please point me in the right direction, thanks.

(In other words, getting the image url from a decal.)

Yes you can, the link is just:

https://www.roblox.com/library/ + id

--For example if the id was 123456789 then the link is:

--https://www.roblox.com/library/123456789

Are you wanting to convert a decal id into an image url?If so, you can try this url out I believe

"rbxthumb://type=Asset&id=YOURIDHERE&w=150&h=150"

Or wait I’m not sure if I understood the question correctly

I’m trying to convert the decal id to an image url, like you said, I’ll try out what you linked, thanks.

1 Like

I’m not sure how likely it is to work since this is typically used for converting a decal id into an image url for use in roblox games

I tried it out and sadly it still didn’t work with my script.

Here’s the script:

function GetImageUrl(player)
	local Layout = player.PlayerGui.CustomBadges.Begin.Type.Value
	local Image = player.PlayerGui.CustomBadges.Middle.Type.Value
	local HS = game:GetService("HttpService")
	local Api_Url = "http://image-merger.herokuapp.com/api/v1.0/"
	local Data = {}
	
	if Layout == 1 then
		
		Data = {
			["foreground_url"] = game:GetService("Players"):GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420),
			["background_url"] = "https://www.roblox.com/asset-thumbnail/image?assetId="..Image.."&22&width=420&height=420&format=png"
		}
	elseif Layout == 2 then
	Data = {
			["foreground_url"] = game:GetService("Players"):GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420),
			["background_url"] = "https://www.roblox.com/asset-thumbnail/image?assetId="..Image.."&22&width=420&height=420&format=png"
		}
	end
	pcall(function()
		Data = HS:JSONEncode(Data)
	end)
	local ReturnData
	pcall(function()
		ReturnData = HS:PostAsync(Api_Url, Data)
	end)
	if ReturnData ~= nil then
		ReturnData = HS:JSONDecode(ReturnData)
		return ReturnData["output_image"]["url"]
	else
		warn("No images were found.")
	end
end

I got this error using pcalls:
Screen Shot 2021-04-01 at 10.35.46 AM

Yeah, just use the link:

"https://www.roblox.com/Thumbs/Asset.ashx?width=420&height=420&assetId="..ID_HERE

No you can’t use it it will throw you an error.

Use this instead:

local httpService = game:GetService("HttpService")
local AssetID = --your assetid
local IconUrl = httpService:JSONDecode(httpService:GetAsync("https://thumbnails.rprxy.xyz/v1/assets?assetIds="..AssetID.."&size=250x250&format=Png&isCircular=false")).data[1].imageUrl

Also very helpful website for getting this URL’s is:
Thumbnails Api (roblox.com)

And also please next time try to use Search because I find this solution here on DevForum before.

3 Likes

How would I do this for a player? I know there’s a function that gets the player’s image, but it doesn’t work in the script.

Like for Player Image? (Thumbnail etc.)
Also can you show me your code again?

Yes ofc! Here is the code I use to get the results you are looking for.

local function fetchThumbnailUrl(decal)
	local success, result = pcall(function()
		local assetId = decal:match("rbxassetid://(%d+)") or decal:match("https?://.+/asset/?id=(%d+)")
		if not assetId then
			error("Invalid asset ID format.")
		end
		local url = "https://thumbnails.roproxy.com/v1/assets?assetIds="..assetId.."&returnPolicy=PlaceHolder&size=512x512&format=Png&isCircular=false"
		local response = HttpService:GetAsync(url)
		local data = HttpService:JSONDecode(response)
		return data.data[1]
	end)

	if success then
		return result
	else
		warn("An error occurred: " .. result)
		return nil
	end
end
1 Like

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