How to obtain the close-up of an avatar?


#1

How would one acquire the close up an avatar’s image? I.e. the image of avatars on the developer forums, or on the home page.
image

My apologies if this is a fairly simple thing to do, but I’ve only been able to acquire the full-body image.
This is my code to get the full-body image:

wait(0.1)

script.Parent.Image= “https://web.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid=”…game.Players.LocalPlayer.UserId

Thanks! :slight_smile:


#2

The wiki has a page on all the image and other api you can use.
http://robloxdev.com/articles/Web-APIs


#3

Thank you so much! :slight_smile:


#4

Roblox web APIs are either not supported or usable in-game to begin with. What we want in this case is an in-game API:

https://wiki.roblox.com/index.php?title=API:Class/Players/GetUserThumbnailAsync

Retrieve a “Headshot” using that method to get the image included in the OP.


#5

it seems to wok just fine in-game.

Will the GetUserThumbail be less likely to break?


#6

Yes, GetUserThumbnail is the officially-supported way to get thumbnails like this. The linked web APIs are intended for internal use, and are a last resort.

  • Some results are JSON results instead of images, meaning you’d have to use HttpService to fetch the actual image, but Roblox endpoints are restricted through HttpService
  • Some endpoints may be removed without notice (e.g. BodyColors)
  • Some endpoints may have their arguments or results changed, breaking your code

In short, if you ever have to use a Roblox web endpoint in-game, run far, far away.


#7

Alright, thanks Echo! :slight_smile:
What about model thumbnails and such? (For future reference and such.)


#8

For models/places, you’ll need to use the web endpoints unfortunately. Roblox does not have an officially supported way to retrieve those. Feel free to make a feature request for this though.


#9

Alright.

Thanks again Echo. :slight_smile: