How to obtain the close-up of an avatar?

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:

6 Likes

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

3 Likes

Thank you so much! :slight_smile:

1 Like

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.

1 Like

it seems to wok just fine in-game.

Will the GetUserThumbail be less likely to break?

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.

8 Likes

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

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.

2 Likes

Alright.

Thanks again Echo. :slight_smile: