I’m trying to create an API for a game, and the API does something with a provided image. So, how can the API get a raw image from a provided asset id?
Thanks.
I’m trying to create an API for a game, and the API does something with a provided image. So, how can the API get a raw image from a provided asset id?
Thanks.
local httpService = game:GetService("HttpService")
function GetContentID(AssetID: number): (boolean | string?)
-- Get the xml
local success, xml = pcall(httpService.GetAsync, httpService, string.format("https://assetdelivery.roproxy.com/v1/asset?id=%i", id))
-- Returns the id if it was a success, otherwise return false
return success and string.match(xml, "?id=(.-)</url>")
end
Original code from decal2image
Thank you, but all that does is returns an xml document which just has the image id for the asset, and I’ve tried that before. I’m looking for the raw image.
Oh, then you can use the same endpoint with the image ID to retrieve it’s content in PNG format.
What? I said I had already checked that API, there is nothing there that returns the raw image, only the asset (Instance) to be added into a game:
Can you tell me what you mean by “raw image”?
An image in png or similar format
This is what you need to get it as a png
What? All that does at most, is return a link like this: “roblox.com/asset/id?=[ID]”, that does absolutely nothing for me, and only works in game. I’m trying to get the image in Javascript, to be exact.
Yes, the [ID] would be the ImageId. Do the assetdelivery request again with the ImageId
Are you using the endpoint with the image Id or the content Id?
I tried this and never did figure out a way to pull anything from an image. In the end I just set up my own shots and put that in … gl
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.