How to get Image URL of a group icon? (Roblox Web Api)

I am wanting to use the Roblox web API for a project of my discord bot, I wanted a kind of !groupinfo command to give the groups information.

I am using the api.roblox.com/groups/{groupid} api to attempt to get the group icon of any group with the supplied ID, the api does return a EmblemUrl but this is not an image file, its a roblox decal download without a file type.

Is there any other api/way to convert this decal into an image file? Any help is appreciated.

If you add on the .png or .jpg file extension to the downloaded file, is it viewable/open-able?

1 Like

It is! Nice catch! Going to http://api.roblox.com/groups/1234567, downloading from the given EmblemUrl link and then appending .png or .jpg to the file both work!

Result

a22d59805956fcbac22fb3cfe1bed3ce

@ExcessEnergy @ankurbohra Correct but it needs to be a direct link, *i cant download the file and append the name using javascript.

1 Like

the link for the group sends a png, you can download that in your discord bot code and add .png onto it and host it somewhere so that its viewable.
If its only one group that you want this for, just right click the group image and click copy image link to copy the image url.

Unfortunately if this is the case, I believe your only option is to modify the extension, and re-upload it somewhere, as @Styre_x mentioned. I don’t know of any roblox endpoints that return a link to an image that is directly viewable.

You could try downloading the file to your bot’s directory, changing the extension, and uploading it to a site like Gyazo, though their developer API. You could then post the viewing link to display the image on discord though the bot, since discord visualizes Gyazo images and gifs automatically.

This would work but a very hacky inefficient process, but I have an idea, the URL given through emblemURL at the end has the decal number, and this number can be used for asset apis on roblox. So theoretically if theres an api for getting image files of a roblox image this could solve my problem.

If you need a link you can pick the AssetId from the EmblemUrl link and use http://api.roblox.com/marketplace/productinfo?assetId={assetId} to get some more information about the image itself. From the previous image we get the following link: http://api.roblox.com/marketplace/productinfo?assetId=198079981:


From here you can pick the AssetId and Name fields to construct a link which previews the image itself, like you would see for any decal etc: The MurkClan - Roblox. Notice we have both the AssetId and the Name to construct this link for any given EmblemUrl.

Then with some webscraping, you can get the element that contains the image element, which lucky for us has the unique class thumbnail-span, the only element with this class has an image element, whose src property is a direct link to the image:
image
You can pick this link off and feed it directly into your bot’s message or embed, without any downloading or modification. You can see it working by replacing any image link through an Embed Visualizer:

2 Likes