GET ImageId from DecalId (In-Game)

httpservice
decal
image

#1

I’ve recently created an API that allows Developers to get the Image Asset Id directly from the Decal Id by sending a request to my proxy server from in-game. This is a very quick method for those trying to use Image’s in-game that they don’t own and can’t access through InsertService. This is also better than trying to remove a digit from the end of the ID and trying to guess the Image ID.

It is very simple to access, and doesn’t require a massive knowledge of programming either.

Incorrect requests will will send a 400 Status Code signifying a malformed/incorrect request, with the error being provided in the response body.

Successful requests will send a 200 Status Code signifying a successful request, and the ImageId will be provided in the response body.

Unsuccessful requests, for example when an Image was not found, will send a 404 Status Code signifying an unsuccessful request, with the error being provided in the response body.

Let’s get to the Lua bit. This is very easy to use, and there are two ways of doing this; RequestAsync and GetAsync.

Below are examples of how to use both.

RequestAsync

local HttpService = game:GetService("HttpService")
 
local reqResponse = HttpService:RequestAsync{
	Url = "http://lordhammy-api.herokuapp.com/api/GetImageFromDecalID/"..DECAL_ID_HERE;
	Method = "GET";
}

if reqResponse.Success then
	print("Status code: " .. reqResponse.StatusCode .. " " .. reqResponse.StatusMessage)
	print("Response body:\n" .. reqResponse.Body)
        -- SUCCESSFUL REQUEST WILL SAY:
        -- Status code: 200 OK
        -- Response body:
        -- IMAGE_ID_HERE
else
	print("The request failed: " .. reqResponse.StatusCode .. " " .. reqResponse.StatusMessage)
end

GetAsync

local httpService = game:GetService('HttpService')

local function GetAsync(Url)
	local reqResults = {}
	ypcall(function ()
		reqResults = { httpService:GetAsync(Url) }
	end)
	return unpack(reqResults)
end

local function GetImageFromDecal(DecalId)
	local ImageID = GetAsync("http://lordhammy-api.herokuapp.com/api/GetImageFromDecalID/"..DecalId)
	if (ImageID and ImageID ~= "No image found for provided DecalId") then
		return ImageID
	end
end

local requestedImage = GetImageFromDecal(DECAL_ID_HERE)
if requestedImage then
    print(requestedImage)
else
    print('Image not found')
end

I know there may be other API’s like this, but this is something I needed personally and decided to release for use. If there are any bugs or suggestions please feel free to let me know below.


#2

image


In case my reply is obscure: this is a neat little creation you have and props to you for demonstrating your skills with web development, but I’m not seeing many use cases for this, if any at all.

  • Inputting decals is almost universally obsolete and only exists in a few games for items like spray paint tools, logo assignment for interaction and other trinkets (assumption)
  • Developers who own the asset can perform this in less lines, the InsertService method, without limitation
  • Probable use case for using it on public domain assets? Studio mode converts ids to their respective asset ids, so the only use case for a trinket would be in-game, which as mentioned in point one, is a feature rarely seen in games (again, assumption)
  • Trouble, oh trouble, should there spawn a strife between the IP holder and the one using the content

On the other hand, it’d be nice to see what’s running on the backend for salvageable content, experimentation or learning. But I don’t assume that’s the purpose of this resource, so I’ll leave that off the table.

tl;dr Cool but can’t see many uses for it. Thanks for sharing and awesome work.


#3

This is released for use for anyone who would like to use it, since I was making this for personal use anyway. If you do not see a point in this, don’t use it. If someone would like to use it, they can, it’s simply a resource that is available to the community. If you search up the title of this post, you’ll see a few people wanted solutions to this anyway.

I would appreciate the feedback regarding use-cases if this was a post asking for opinions regarding whether or not I should make this, but I have already made this so there’s not much for me to do with the information you have provided.

Regarding the Intellectual Property, if there is an issue with this I will most likely be contacted about it, however I can just go to anyone’s Inventory, click on a Decal, and use it in studio, so I doubt it’s that big of an issue. If it is, once again, I will most likely be contacted about it.


#5

This is gonna be very useful for a game of mine.

Much thanks


#6
  • Inputting decals is almost universally obsolete and only exists in a few games for items like spray paint tools, logo assignment for interaction and other trinkets (assumption)

No, many games allow players to use decals for things like wallpaper (Work at a Pizza Place does this. I think @GeorgeTheDev uses something like this for custom car skins in his game.).

  • Developers who own the asset can perform this in less lines, the InsertService method, without limitation

Why would a developer who owns the decal and can therefore very easily figure out the texture ID of the decal need this?

  • Probable use case for using it on public domain assets?

If it’s a free decal it is technically in the public domain.

  • Trouble, oh trouble, should there spawn a strife between the IP holder and the one using the content

This will never happen to you if your players are inputting the decal IDs which is the main thing this would be used for. Even then, I don’t think anyone will go after you for using a decal on Roblox, especially if it was uploaded by someone else.

I think this was unnecessary criticism. The real issue here is that if someone were to use this on a production game, they would be relying on someone else’s web server (which is never a good thing.)


#7

Can confirm. In the past I’ve made it so if a user puts in the decal ID for a custom car, I have to use the Thumbnail which is 420x420 resolution, which is garbage quality compared to the native 2048x2048. So this is big for me.


#8

@LordHammy

I don’t use things if I have no use for them? I’m coming from an objective personal perspective. It’s not criticism, it’s a personal stance.


@Intended_Pun

Keyword: assumption. Note that I already said spray cans and small things like wallpapers. Not many games actually, other than this, use other decals. Many games doesn’t mean a few hundred out of many tens of thousands.

This response to my point makes no sense. What are you trying to tell me here? I’m saying that if the developer owns the asset, they don’t need this resource. You’re repeating what point I’m making.

Again I don’t understand what you mean by this reply. I said you can probably find a use for this by using it on decals in the public domain without needing to take them, not that it’s a problem. Please read what I say before replying.

It’s not a specific remark towards players, it can apply towards developers as well. I think various developers value their work on a game and depending on what you use, I can definitely see problems arising between developers. IP is IP, respect their rights to their works.

It wasn’t criticism in the first place? It’s an objective perspective on it’s usage. If you can find a use then good for you.

…?


#9

for those trying to use Image’s in-game that they don’t own and can’t access through InsertService.

@CloneTrooper1019, are you saying that you can Access ALL assets with InsertService?


#10

I’m pretty sure decals can be inserted regardless if they are free or not. A decal being free just indicates you can take it and use it from Roblox’s toolbox. It can still be loaded from the InsertService either way.


#11

game.InsertService:LoadAsset(896320268).Parent = workspace
HTTP 403 (HTTP/1.1 403 Asset is not trusted for this place)

image

Asset

It’s not a For Sale, and I don’t own it.

Asset I own (I uploaded this and it seems like doesn’t matter if it’s in my Inventory or not It never works)

image


From my experience you can only Insert Assets that You and Roblox owns (and maybe Assets that are For Sale) but NOT Assets that aren’t for sale.

but right now it seems like you can only Insert Assets that are ONLY Owned by Roblox, idk what’s up but it better get fixed soon.


#12

Right then, my apologies.
I didn’t recall correctly how I did this in Super Nostalgia Zone.

It turns out that I was using Roblox’s thumbnail endpoint for rendering decals as images, which suited my needs appropriately.

I think my assertion is correct for T-Shirts and other clothing items though, whoops.


#13

Are you able to load in Decals through thumbnail endpoints? How does that work?


#14

:thinking:


#15

My understanding was the server could insert anything that the place owner owns OR Roblox’s official account owns. Not both are necessary. Unless it changed? :man_shrugging:


#16

No, it hasn’t changed. This is correct. Only assets you or Roblox own can be inserted. Free assets still have to be owned, otherwise they’ll return an HTTP 403 error as per ownership checks.

So long as it’s in your inventory, it’s usable.


#17

Isn’t it assets you, ROBLOX or Games own? I remember reading that somewhere.


#18

No. Games is a separate Roblox account utilized by Roblox but their assets are on the same level as a regular user’s. Only the Roblox account (ID 1) has elevated permissions across all assets.


#19

My apologies. It seemed like you were saying OP shouldn’t have made this since nobody would use it and it could be used to infringe copyright.


#20

Not at all. All I’m saying is that personally, I can’t find large amounts of use cases for this since there are not a hankering amount of games that use user input for decals nowadays, but this is a cool creation. Its an awesome web trinket that’s like the InsertService workaround but not exactly it. It’s just how many people will use it and what it’s used for is my concern.

OP did say it was for personal use but he was releasing for anyone who wants to use it anyway.