Skip to content

thumbnails

Contains objects related to Roblox thumbnails.

AvatarThumbnailType

Bases: Enum

Type of avatar thumbnail.

Source code in roblox/thumbnails.py
52
53
54
55
56
57
58
59
class AvatarThumbnailType(Enum):
    """
    Type of avatar thumbnail.
    """

    full_body = "full_body"
    headshot = "headshot"
    bust = "bust"

Thumbnail

Represents a Roblox thumbnail as returned by almost all endpoints on https://thumbnails.roblox.com/.

Attributes:

Name Type Description
target_id int

The id of the target of the image.

state ThumbnailState

The current state of the image.

image_url Optional[str]

Url of the image.

Source code in roblox/thumbnails.py
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
class Thumbnail:
    """
    Represents a Roblox thumbnail as returned by almost all endpoints on https://thumbnails.roblox.com/.

    Attributes:
        target_id: The id of the target of the image.
        state: The current state of the image.
        image_url: Url of the image.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: Client object.
            data: The data from the request.
        """
        self._client: Client = client

        self.target_id: int = data["targetId"]
        self.state: ThumbnailState = ThumbnailState(data["state"])
        self.image_url: Optional[str] = data["imageUrl"]

    def __repr__(self):
        return f"<{self.__class__.__name__} target_id={self.target_id} name={self.state!r} " \
               f"image_url={self.image_url!r}>"

    async def get_3d_data(self) -> ThreeDThumbnail:
        """
        Generates 3D thumbnail data for this endpoint.

        Returns:
            A ThreeDThumbnail.
        """
        threed_response = await self._client.requests.get(
            url=self.image_url
        )
        threed_data = threed_response.json()
        return ThreeDThumbnail(
            client=self._client,
            data=threed_data
        )

__init__(client, data)

Parameters:

Name Type Description Default
client Client

Client object.

required
data dict

The data from the request.

required
Source code in roblox/thumbnails.py
82
83
84
85
86
87
88
89
90
91
92
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: Client object.
        data: The data from the request.
    """
    self._client: Client = client

    self.target_id: int = data["targetId"]
    self.state: ThumbnailState = ThumbnailState(data["state"])
    self.image_url: Optional[str] = data["imageUrl"]

get_3d_data() async

Generates 3D thumbnail data for this endpoint.

Returns:

Type Description
ThreeDThumbnail

A ThreeDThumbnail.

Source code in roblox/thumbnails.py
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
async def get_3d_data(self) -> ThreeDThumbnail:
    """
    Generates 3D thumbnail data for this endpoint.

    Returns:
        A ThreeDThumbnail.
    """
    threed_response = await self._client.requests.get(
        url=self.image_url
    )
    threed_data = threed_response.json()
    return ThreeDThumbnail(
        client=self._client,
        data=threed_data
    )

ThumbnailFormat

Bases: Enum

Format returned by the endpoint.

Source code in roblox/thumbnails.py
43
44
45
46
47
48
49
class ThumbnailFormat(Enum):
    """
    Format returned by the endpoint.
    """

    png = "Png"
    jpeg = "Jpeg"

ThumbnailProvider

The ThumbnailProvider that provides multiple functions for generating user thumbnails.

Source code in roblox/thumbnails.py
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
class ThumbnailProvider:
    """
    The ThumbnailProvider that provides multiple functions for generating user thumbnails.
    """

    def __init__(self, client: Client):
        """
        Arguments:
            client: Client object.
        """
        self._client: Client = client

    async def get_asset_thumbnails(
            self,
            assets: List[AssetOrAssetId],
            return_policy: ThumbnailReturnPolicy = ThumbnailReturnPolicy.place_holder,
            size: SizeTupleOrString = (30, 30),
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
    ) -> List[Thumbnail]:
        """
        Returns asset thumbnails for the asset ID passed.
        Supported sizes:  
        - 30x30  
        - 42x42  
        - 50x50  
        - 60x62  
        - 75x75  
        - 110x110  
        - 140x140  
        - 150x150  
        - 160x100  
        - 160x600  
        - 250x250  
        - 256x144  
        - 300x250  
        - 304x166  
        - 384x216  
        - 396x216  
        - 420x420  
        - 480x270  
        - 512x512  
        - 576x324  
        - 700x700  
        - 728x90  
        - 768x432  

        Arguments:
            assets: Assets you want the thumbnails of.
            return_policy: How you want it returns look at enum.
            size: size of the image.
            image_format: Format of the image.
            is_circular: if the image is a circle yes or no.

        Returns:
            A list of Thumbnails.
        """
        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", "v1/assets"),
            params={
                "assetIds": list(map(int, assets)),
                "returnPolicy": return_policy.value,
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )
        thumbnails_data = thumbnails_response.json()["data"]
        return [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_asset_thumbnail_3d(self, asset: AssetOrAssetId) -> Thumbnail:
        """
        Returns a 3D asset thumbnail for the user ID passed.

        Arguments:
            asset: Asset you want the thumbnails of.

        Returns:
            A Thumbnail.
        """
        thumbnail_response = await self._client.requests.get(
            url=self._client.url_generator.get_url(
                "thumbnails", "v1/assets-thumbnail-3d"
            ),
            params={"assetId": int(asset)},
        )
        thumbnail_data = thumbnail_response.json()
        return Thumbnail(client=self._client, data=thumbnail_data)

    async def get_badge_icons(
            self,
            badges: List[BadgeOrBadgeId],
            size: SizeTupleOrString = (150, 150),
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
    ) -> List[Thumbnail]:
        """
        Returns badge icons for each badge ID passed.
        Supported sizes:  
        - 150x150  

        Arguments:
            badges: Badges you want the thumbnails of.
            size: size of the image.
            image_format: Format of the image.
            is_circular: if the image is a circle yes or no.

        Returns:
            A list of Thumbnails.
        """
        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", "v1/badges/icons"),
            params={
                "badgeIds": list(map(int, badges)),
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )
        thumbnails_data = thumbnails_response.json()["data"]
        return [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_gamepass_icons(
            self,
            gamepasses: List[GamePassOrGamePassId],
            # TODO Make size enum
            size: SizeTupleOrString = (150, 150),
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
    ) -> List[Thumbnail]:
        """
        Returns gamepass icons for each gamepass ID passed.
        Supported sizes:  
        - 150x150  

        Arguments:
            gamepasses: Gamepasses you want the thumbnails of.
            size: size of the image.
            image_format: Format of the image.
            is_circular: If the image is a circle yes or no.

        Returns:
            A list of Thumbnails.
        """
        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", "v1/game-passes"),
            params={
                "gamePassIds": list(map(int, gamepasses)),
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )
        thumbnails_data = thumbnails_response.json()["data"]
        return [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_universe_icons(
            self,
            universes: List[UniverseOrUniverseId],
            return_policy: ThumbnailReturnPolicy = ThumbnailReturnPolicy.place_holder,
            size: SizeTupleOrString = (50, 50),
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
    ) -> List[Thumbnail]:
        """
        Returns universe icons for each universe ID passed.
        Supported sizes:  
        - 50x50  
        - 128x128  
        - 150x150  
        - 256x256  
        - 512x512  
        - 768x432  

        Arguments:
            universes: Universes you want the thumbnails of.
            return_policy: How you want it returns look at enum.
            size: size of the image.
            image_format: Format of the image.
            is_circular: If the image is a circle yes or no.

        Returns:
            A list of Thumbnails.
        """
        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", "v1/games/icons"),
            params={
                "universeIds": list(map(int, universes)),
                "returnPolicy": return_policy.value,
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )
        thumbnails_data = thumbnails_response.json()["data"]
        return [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_universe_thumbnails(
            self,
            universes: List[UniverseOrUniverseId],
            size: SizeTupleOrString = (768, 432),
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
            count_per_universe: int = None,
            defaults: bool = None,
    ) -> List[UniverseThumbnails]:
        """
        Returns universe thumbnails for each universe ID passed.
        Supported sizes:  
        - 768x432  
        - 576x324  
        - 480x270  
        - 384x216  
        - 256x144  

        Arguments:
            universes: Universes you want the thumbnails of.
            size: size of the image.
            image_format: Format of the image.
            count_per_universe: Unknown.
            is_circular: If the image is a circle yes or no.
            defaults: Whether to return default thumbnails.

        Returns:
            A list of Thumbnails.
        """
        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url(
                "thumbnails", "v1/games/multiget/thumbnails"
            ),
            params={
                "universeIds": list(map(int, universes)),
                "countPerUniverse": count_per_universe,
                "defaults": defaults,
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )
        thumbnails_data = thumbnails_response.json()["data"]
        return [
            UniverseThumbnails(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_group_icons(
            self,
            groups: List[GroupOrGroupId],
            size: SizeTupleOrString = (150, 150),
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
    ) -> List[Thumbnail]:
        """
        Returns icons for each group ID passed.
        Supported sizes:  
        - 150x150  
        - 420x420  

        Arguments:
            groups: Groups you want the thumbnails of.
            size: size of the image.
            image_format: Format of the image.
            is_circular: If the image is a circle yes or no.

        Returns:
            A list of Thumbnails.
        """
        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", "v1/groups/icons"),
            params={
                "groupIds": list(map(int, groups)),
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )
        thumbnails_data = thumbnails_response.json()["data"]
        return [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_place_icons(
            self,
            places: List[PlaceOrPlaceId],
            return_policy: ThumbnailReturnPolicy = ThumbnailReturnPolicy.place_holder,
            size: SizeTupleOrString = (50, 50),
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
    ) -> List[Thumbnail]:
        """
        Returns icons for each place ID passed.
        Supported sizes:  
        - 50x50  
        - 128x128  
        - 150x150  
        - 256x256  
        - 512x512  
        - 768x432  

        Arguments:
            places: Places you want the thumbnails of.
            return_policy: How you want it returns look at enum.
            size: size of the image.
            image_format: Format of the image.
            is_circular: if the image is a circle yes or no.
        Returns:
            A List of Thumbnails.
        """
        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", "v1/places/gameicons"),
            params={
                "placeIds": list(map(int, places)),
                "returnPolicy": return_policy.value,
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )
        thumbnails_data = thumbnails_response.json()["data"]
        return [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_user_avatar_thumbnails(
            self,
            users: List[UserOrUserId],
            type: AvatarThumbnailType = AvatarThumbnailType.full_body,
            size: SizeTupleOrString = None,
            image_format: ThumbnailFormat = ThumbnailFormat.png,
            is_circular: bool = False,
    ) -> List[Thumbnail]:
        """
        Returns avatar thumbnails for each user ID passed.
        The valid sizes depend on the `type` parameter.

        | Size | full_body | headshot | bust |
        |---|---|---|---|
        | 30x30 | ✔️ | ❌ | ❌ |
        | 48x48 | ✔️ | ✔️ | ✔️ |
        | 50x50 | ❌ | ✔️ | ✔️ |
        | 60x60 | ✔️ | ✔️ | ✔️ |
        | 75x75 | ✔️ | ✔️ | ✔️ |
        | 100x100 | ✔️ | ✔️ | ✔️ |
        | 110x110 | ✔️ | ✔️ | ❌ |
        | 140x140 | ✔️ | ❌ | ❌ |
        | 150x150 | ✔️ | ✔️ | ✔️ |
        | 150x200 | ✔️ | ❌ | ❌ |
        | 180x180 | ✔️ | ✔️ | ✔️ |
        | 250x250 | ✔️ | ❌ | ❌ |
        | 352x352 | ✔️ | ✔️ | ✔️ |
        | 420x420 | ✔️ | ✔️ | ✔️ |
        | 720x720 | ✔️ | ❌ | ❌ |

        Arguments:
            users: Id of the users you want the thumbnails of.
            type: Type of avatar thumbnail you want look at enum.
            size: size of the image.
            image_format: Format of the image.
            is_circular: If the image is a circle yes or no.

        Returns:
            A list of Thumbnails.
        """
        uri: str
        if type == AvatarThumbnailType.full_body:
            uri = "avatar"
            size = size or (30, 30)
        elif type == AvatarThumbnailType.bust:
            uri = "avatar-bust"
            size = size or (48, 48)
        elif type == AvatarThumbnailType.headshot:
            uri = "avatar-headshot"
            size = size or (48, 48)
        else:
            raise ValueError("Avatar type is invalid.")

        thumbnails_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", f"v1/users/{uri}"),
            params={
                "userIds": list(map(int, users)),
                "size": _to_size_string(size),
                "format": image_format.value,
                "isCircular": is_circular,
            },
        )

        thumbnails_data = thumbnails_response.json()["data"]
        return [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in thumbnails_data
        ]

    async def get_user_avatar_thumbnail_3d(self, user: UserOrUserId) -> Thumbnail:
        """
        Returns the user's thumbnail in 3d.

        Arguments:
            user: User you want the 3d thumbnail of.

        Returns:
            A Thumbnail.
        """
        thumbnail_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("thumbnails", "v1/users/avatar-3d"),
            params={
                "userId": int(user)
            },
        )
        thumbnail_data = thumbnail_response.json()
        return Thumbnail(client=self._client, data=thumbnail_data)

__init__(client)

Parameters:

Name Type Description Default
client Client

Client object.

required
Source code in roblox/thumbnails.py
146
147
148
149
150
151
def __init__(self, client: Client):
    """
    Arguments:
        client: Client object.
    """
    self._client: Client = client

get_asset_thumbnail_3d(asset) async

Returns a 3D asset thumbnail for the user ID passed.

Parameters:

Name Type Description Default
asset AssetOrAssetId

Asset you want the thumbnails of.

required

Returns:

Type Description
Thumbnail

A Thumbnail.

Source code in roblox/thumbnails.py
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
async def get_asset_thumbnail_3d(self, asset: AssetOrAssetId) -> Thumbnail:
    """
    Returns a 3D asset thumbnail for the user ID passed.

    Arguments:
        asset: Asset you want the thumbnails of.

    Returns:
        A Thumbnail.
    """
    thumbnail_response = await self._client.requests.get(
        url=self._client.url_generator.get_url(
            "thumbnails", "v1/assets-thumbnail-3d"
        ),
        params={"assetId": int(asset)},
    )
    thumbnail_data = thumbnail_response.json()
    return Thumbnail(client=self._client, data=thumbnail_data)

get_asset_thumbnails(assets, return_policy=ThumbnailReturnPolicy.place_holder, size=(30, 30), image_format=ThumbnailFormat.png, is_circular=False) async

Returns asset thumbnails for the asset ID passed. Supported sizes:
- 30x30
- 42x42
- 50x50
- 60x62
- 75x75
- 110x110
- 140x140
- 150x150
- 160x100
- 160x600
- 250x250
- 256x144
- 300x250
- 304x166
- 384x216
- 396x216
- 420x420
- 480x270
- 512x512
- 576x324
- 700x700
- 728x90
- 768x432

Parameters:

Name Type Description Default
assets List[AssetOrAssetId]

Assets you want the thumbnails of.

required
return_policy ThumbnailReturnPolicy

How you want it returns look at enum.

place_holder
size SizeTupleOrString

size of the image.

(30, 30)
image_format ThumbnailFormat

Format of the image.

png
is_circular bool

if the image is a circle yes or no.

False

Returns:

Type Description
List[Thumbnail]

A list of Thumbnails.

Source code in roblox/thumbnails.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
async def get_asset_thumbnails(
        self,
        assets: List[AssetOrAssetId],
        return_policy: ThumbnailReturnPolicy = ThumbnailReturnPolicy.place_holder,
        size: SizeTupleOrString = (30, 30),
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
) -> List[Thumbnail]:
    """
    Returns asset thumbnails for the asset ID passed.
    Supported sizes:  
    - 30x30  
    - 42x42  
    - 50x50  
    - 60x62  
    - 75x75  
    - 110x110  
    - 140x140  
    - 150x150  
    - 160x100  
    - 160x600  
    - 250x250  
    - 256x144  
    - 300x250  
    - 304x166  
    - 384x216  
    - 396x216  
    - 420x420  
    - 480x270  
    - 512x512  
    - 576x324  
    - 700x700  
    - 728x90  
    - 768x432  

    Arguments:
        assets: Assets you want the thumbnails of.
        return_policy: How you want it returns look at enum.
        size: size of the image.
        image_format: Format of the image.
        is_circular: if the image is a circle yes or no.

    Returns:
        A list of Thumbnails.
    """
    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", "v1/assets"),
        params={
            "assetIds": list(map(int, assets)),
            "returnPolicy": return_policy.value,
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )
    thumbnails_data = thumbnails_response.json()["data"]
    return [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

get_badge_icons(badges, size=(150, 150), image_format=ThumbnailFormat.png, is_circular=False) async

Returns badge icons for each badge ID passed. Supported sizes:
- 150x150

Parameters:

Name Type Description Default
badges List[BadgeOrBadgeId]

Badges you want the thumbnails of.

required
size SizeTupleOrString

size of the image.

(150, 150)
image_format ThumbnailFormat

Format of the image.

png
is_circular bool

if the image is a circle yes or no.

False

Returns:

Type Description
List[Thumbnail]

A list of Thumbnails.

Source code in roblox/thumbnails.py
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
async def get_badge_icons(
        self,
        badges: List[BadgeOrBadgeId],
        size: SizeTupleOrString = (150, 150),
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
) -> List[Thumbnail]:
    """
    Returns badge icons for each badge ID passed.
    Supported sizes:  
    - 150x150  

    Arguments:
        badges: Badges you want the thumbnails of.
        size: size of the image.
        image_format: Format of the image.
        is_circular: if the image is a circle yes or no.

    Returns:
        A list of Thumbnails.
    """
    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", "v1/badges/icons"),
        params={
            "badgeIds": list(map(int, badges)),
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )
    thumbnails_data = thumbnails_response.json()["data"]
    return [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

get_gamepass_icons(gamepasses, size=(150, 150), image_format=ThumbnailFormat.png, is_circular=False) async

Returns gamepass icons for each gamepass ID passed. Supported sizes:
- 150x150

Parameters:

Name Type Description Default
gamepasses List[GamePassOrGamePassId]

Gamepasses you want the thumbnails of.

required
size SizeTupleOrString

size of the image.

(150, 150)
image_format ThumbnailFormat

Format of the image.

png
is_circular bool

If the image is a circle yes or no.

False

Returns:

Type Description
List[Thumbnail]

A list of Thumbnails.

Source code in roblox/thumbnails.py
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
async def get_gamepass_icons(
        self,
        gamepasses: List[GamePassOrGamePassId],
        # TODO Make size enum
        size: SizeTupleOrString = (150, 150),
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
) -> List[Thumbnail]:
    """
    Returns gamepass icons for each gamepass ID passed.
    Supported sizes:  
    - 150x150  

    Arguments:
        gamepasses: Gamepasses you want the thumbnails of.
        size: size of the image.
        image_format: Format of the image.
        is_circular: If the image is a circle yes or no.

    Returns:
        A list of Thumbnails.
    """
    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", "v1/game-passes"),
        params={
            "gamePassIds": list(map(int, gamepasses)),
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )
    thumbnails_data = thumbnails_response.json()["data"]
    return [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

get_group_icons(groups, size=(150, 150), image_format=ThumbnailFormat.png, is_circular=False) async

Returns icons for each group ID passed. Supported sizes:
- 150x150
- 420x420

Parameters:

Name Type Description Default
groups List[GroupOrGroupId]

Groups you want the thumbnails of.

required
size SizeTupleOrString

size of the image.

(150, 150)
image_format ThumbnailFormat

Format of the image.

png
is_circular bool

If the image is a circle yes or no.

False

Returns:

Type Description
List[Thumbnail]

A list of Thumbnails.

Source code in roblox/thumbnails.py
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
async def get_group_icons(
        self,
        groups: List[GroupOrGroupId],
        size: SizeTupleOrString = (150, 150),
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
) -> List[Thumbnail]:
    """
    Returns icons for each group ID passed.
    Supported sizes:  
    - 150x150  
    - 420x420  

    Arguments:
        groups: Groups you want the thumbnails of.
        size: size of the image.
        image_format: Format of the image.
        is_circular: If the image is a circle yes or no.

    Returns:
        A list of Thumbnails.
    """
    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", "v1/groups/icons"),
        params={
            "groupIds": list(map(int, groups)),
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )
    thumbnails_data = thumbnails_response.json()["data"]
    return [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

get_place_icons(places, return_policy=ThumbnailReturnPolicy.place_holder, size=(50, 50), image_format=ThumbnailFormat.png, is_circular=False) async

Returns icons for each place ID passed. Supported sizes:
- 50x50
- 128x128
- 150x150
- 256x256
- 512x512
- 768x432

Parameters:

Name Type Description Default
places List[PlaceOrPlaceId]

Places you want the thumbnails of.

required
return_policy ThumbnailReturnPolicy

How you want it returns look at enum.

place_holder
size SizeTupleOrString

size of the image.

(50, 50)
image_format ThumbnailFormat

Format of the image.

png
is_circular bool

if the image is a circle yes or no.

False
Source code in roblox/thumbnails.py
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
async def get_place_icons(
        self,
        places: List[PlaceOrPlaceId],
        return_policy: ThumbnailReturnPolicy = ThumbnailReturnPolicy.place_holder,
        size: SizeTupleOrString = (50, 50),
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
) -> List[Thumbnail]:
    """
    Returns icons for each place ID passed.
    Supported sizes:  
    - 50x50  
    - 128x128  
    - 150x150  
    - 256x256  
    - 512x512  
    - 768x432  

    Arguments:
        places: Places you want the thumbnails of.
        return_policy: How you want it returns look at enum.
        size: size of the image.
        image_format: Format of the image.
        is_circular: if the image is a circle yes or no.
    Returns:
        A List of Thumbnails.
    """
    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", "v1/places/gameicons"),
        params={
            "placeIds": list(map(int, places)),
            "returnPolicy": return_policy.value,
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )
    thumbnails_data = thumbnails_response.json()["data"]
    return [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

get_universe_icons(universes, return_policy=ThumbnailReturnPolicy.place_holder, size=(50, 50), image_format=ThumbnailFormat.png, is_circular=False) async

Returns universe icons for each universe ID passed. Supported sizes:
- 50x50
- 128x128
- 150x150
- 256x256
- 512x512
- 768x432

Parameters:

Name Type Description Default
universes List[UniverseOrUniverseId]

Universes you want the thumbnails of.

required
return_policy ThumbnailReturnPolicy

How you want it returns look at enum.

place_holder
size SizeTupleOrString

size of the image.

(50, 50)
image_format ThumbnailFormat

Format of the image.

png
is_circular bool

If the image is a circle yes or no.

False

Returns:

Type Description
List[Thumbnail]

A list of Thumbnails.

Source code in roblox/thumbnails.py
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
async def get_universe_icons(
        self,
        universes: List[UniverseOrUniverseId],
        return_policy: ThumbnailReturnPolicy = ThumbnailReturnPolicy.place_holder,
        size: SizeTupleOrString = (50, 50),
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
) -> List[Thumbnail]:
    """
    Returns universe icons for each universe ID passed.
    Supported sizes:  
    - 50x50  
    - 128x128  
    - 150x150  
    - 256x256  
    - 512x512  
    - 768x432  

    Arguments:
        universes: Universes you want the thumbnails of.
        return_policy: How you want it returns look at enum.
        size: size of the image.
        image_format: Format of the image.
        is_circular: If the image is a circle yes or no.

    Returns:
        A list of Thumbnails.
    """
    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", "v1/games/icons"),
        params={
            "universeIds": list(map(int, universes)),
            "returnPolicy": return_policy.value,
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )
    thumbnails_data = thumbnails_response.json()["data"]
    return [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

get_universe_thumbnails(universes, size=(768, 432), image_format=ThumbnailFormat.png, is_circular=False, count_per_universe=None, defaults=None) async

Returns universe thumbnails for each universe ID passed. Supported sizes:
- 768x432
- 576x324
- 480x270
- 384x216
- 256x144

Parameters:

Name Type Description Default
universes List[UniverseOrUniverseId]

Universes you want the thumbnails of.

required
size SizeTupleOrString

size of the image.

(768, 432)
image_format ThumbnailFormat

Format of the image.

png
count_per_universe int

Unknown.

None
is_circular bool

If the image is a circle yes or no.

False
defaults bool

Whether to return default thumbnails.

None

Returns:

Type Description
List[UniverseThumbnails]

A list of Thumbnails.

Source code in roblox/thumbnails.py
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
async def get_universe_thumbnails(
        self,
        universes: List[UniverseOrUniverseId],
        size: SizeTupleOrString = (768, 432),
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
        count_per_universe: int = None,
        defaults: bool = None,
) -> List[UniverseThumbnails]:
    """
    Returns universe thumbnails for each universe ID passed.
    Supported sizes:  
    - 768x432  
    - 576x324  
    - 480x270  
    - 384x216  
    - 256x144  

    Arguments:
        universes: Universes you want the thumbnails of.
        size: size of the image.
        image_format: Format of the image.
        count_per_universe: Unknown.
        is_circular: If the image is a circle yes or no.
        defaults: Whether to return default thumbnails.

    Returns:
        A list of Thumbnails.
    """
    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url(
            "thumbnails", "v1/games/multiget/thumbnails"
        ),
        params={
            "universeIds": list(map(int, universes)),
            "countPerUniverse": count_per_universe,
            "defaults": defaults,
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )
    thumbnails_data = thumbnails_response.json()["data"]
    return [
        UniverseThumbnails(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

get_user_avatar_thumbnail_3d(user) async

Returns the user's thumbnail in 3d.

Parameters:

Name Type Description Default
user UserOrUserId

User you want the 3d thumbnail of.

required

Returns:

Type Description
Thumbnail

A Thumbnail.

Source code in roblox/thumbnails.py
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
async def get_user_avatar_thumbnail_3d(self, user: UserOrUserId) -> Thumbnail:
    """
    Returns the user's thumbnail in 3d.

    Arguments:
        user: User you want the 3d thumbnail of.

    Returns:
        A Thumbnail.
    """
    thumbnail_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", "v1/users/avatar-3d"),
        params={
            "userId": int(user)
        },
    )
    thumbnail_data = thumbnail_response.json()
    return Thumbnail(client=self._client, data=thumbnail_data)

get_user_avatar_thumbnails(users, type=AvatarThumbnailType.full_body, size=None, image_format=ThumbnailFormat.png, is_circular=False) async

Returns avatar thumbnails for each user ID passed. The valid sizes depend on the type parameter.

Size full_body headshot bust
30x30 ✔️
48x48 ✔️ ✔️ ✔️
50x50 ✔️ ✔️
60x60 ✔️ ✔️ ✔️
75x75 ✔️ ✔️ ✔️
100x100 ✔️ ✔️ ✔️
110x110 ✔️ ✔️
140x140 ✔️
150x150 ✔️ ✔️ ✔️
150x200 ✔️
180x180 ✔️ ✔️ ✔️
250x250 ✔️
352x352 ✔️ ✔️ ✔️
420x420 ✔️ ✔️ ✔️
720x720 ✔️

Parameters:

Name Type Description Default
users List[UserOrUserId]

Id of the users you want the thumbnails of.

required
type AvatarThumbnailType

Type of avatar thumbnail you want look at enum.

full_body
size SizeTupleOrString

size of the image.

None
image_format ThumbnailFormat

Format of the image.

png
is_circular bool

If the image is a circle yes or no.

False

Returns:

Type Description
List[Thumbnail]

A list of Thumbnails.

Source code in roblox/thumbnails.py
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
async def get_user_avatar_thumbnails(
        self,
        users: List[UserOrUserId],
        type: AvatarThumbnailType = AvatarThumbnailType.full_body,
        size: SizeTupleOrString = None,
        image_format: ThumbnailFormat = ThumbnailFormat.png,
        is_circular: bool = False,
) -> List[Thumbnail]:
    """
    Returns avatar thumbnails for each user ID passed.
    The valid sizes depend on the `type` parameter.

    | Size | full_body | headshot | bust |
    |---|---|---|---|
    | 30x30 | ✔️ | ❌ | ❌ |
    | 48x48 | ✔️ | ✔️ | ✔️ |
    | 50x50 | ❌ | ✔️ | ✔️ |
    | 60x60 | ✔️ | ✔️ | ✔️ |
    | 75x75 | ✔️ | ✔️ | ✔️ |
    | 100x100 | ✔️ | ✔️ | ✔️ |
    | 110x110 | ✔️ | ✔️ | ❌ |
    | 140x140 | ✔️ | ❌ | ❌ |
    | 150x150 | ✔️ | ✔️ | ✔️ |
    | 150x200 | ✔️ | ❌ | ❌ |
    | 180x180 | ✔️ | ✔️ | ✔️ |
    | 250x250 | ✔️ | ❌ | ❌ |
    | 352x352 | ✔️ | ✔️ | ✔️ |
    | 420x420 | ✔️ | ✔️ | ✔️ |
    | 720x720 | ✔️ | ❌ | ❌ |

    Arguments:
        users: Id of the users you want the thumbnails of.
        type: Type of avatar thumbnail you want look at enum.
        size: size of the image.
        image_format: Format of the image.
        is_circular: If the image is a circle yes or no.

    Returns:
        A list of Thumbnails.
    """
    uri: str
    if type == AvatarThumbnailType.full_body:
        uri = "avatar"
        size = size or (30, 30)
    elif type == AvatarThumbnailType.bust:
        uri = "avatar-bust"
        size = size or (48, 48)
    elif type == AvatarThumbnailType.headshot:
        uri = "avatar-headshot"
        size = size or (48, 48)
    else:
        raise ValueError("Avatar type is invalid.")

    thumbnails_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("thumbnails", f"v1/users/{uri}"),
        params={
            "userIds": list(map(int, users)),
            "size": _to_size_string(size),
            "format": image_format.value,
            "isCircular": is_circular,
        },
    )

    thumbnails_data = thumbnails_response.json()["data"]
    return [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in thumbnails_data
    ]

ThumbnailReturnPolicy

Bases: Enum

The return policy for place/universe thumbnails.

Source code in roblox/thumbnails.py
33
34
35
36
37
38
39
40
class ThumbnailReturnPolicy(Enum):
    """
    The return policy for place/universe thumbnails.
    """

    place_holder = "PlaceHolder"
    auto_generated = "AutoGenerated"
    force_auto_generated = "ForceAutoGenerated"

ThumbnailState

Bases: Enum

The current state of the thumbnail.

Source code in roblox/thumbnails.py
20
21
22
23
24
25
26
27
28
29
30
class ThumbnailState(Enum):
    """
    The current state of the thumbnail.
    """

    completed = "Completed"
    in_review = "InReview"
    pending = "Pending"
    error = "Error"
    moderated = "Moderated"
    blocked = "Blocked"

UniverseThumbnails

Represents a universe's thumbnails as returned by https://thumbnails.roblox.com/v1/games/multiget/thumbnails.

Attributes:

Name Type Description
universe_id int

The id of the target of the image.

error Optional[str]

The errors you got.

thumbnails List[Thumbnail]

List of thumbnails.

Source code in roblox/thumbnails.py
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
class UniverseThumbnails:
    """
    Represents a universe's thumbnails as returned by https://thumbnails.roblox.com/v1/games/multiget/thumbnails.

    Attributes:
        universe_id: The id of the target of the image.
        error: The errors you got.
        thumbnails: List of thumbnails.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: Shared object.
            data: The data from the request.
        """
        self._client: Client = client
        # todo add base universe maby
        self.universe_id: int = data["universeId"]
        self.error: Optional[str] = data["error"]
        self.thumbnails: List[Thumbnail] = [
            Thumbnail(client=self._client, data=thumbnail_data)
            for thumbnail_data in data["thumbnails"]
        ]

__init__(client, data)

Parameters:

Name Type Description Default
client Client

Shared object.

required
data dict

The data from the request.

required
Source code in roblox/thumbnails.py
125
126
127
128
129
130
131
132
133
134
135
136
137
138
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: Shared object.
        data: The data from the request.
    """
    self._client: Client = client
    # todo add base universe maby
    self.universe_id: int = data["universeId"]
    self.error: Optional[str] = data["error"]
    self.thumbnails: List[Thumbnail] = [
        Thumbnail(client=self._client, data=thumbnail_data)
        for thumbnail_data in data["thumbnails"]
    ]