Skip to content

Commit f60d191

Browse files
author
Roberto De Ioris
authored
Create Thumbnail_API.md
1 parent c405a85 commit f60d191

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

docs/Thumbnail_API.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# The Thumbnail API
2+
3+
The UE4 python api exposes two main functions to access thumbnails:
4+
5+
```python
6+
thumbnail = uobject.get_thumbnail([force_create])
7+
```
8+
9+
This function tries to get the thumbnail of an object from the cache, or (if not found in the cache) from the package file.
10+
11+
The boolean argument, if True, forces the function to generate a new thumbnail (with the default size) if not available in the asset/package
12+
13+
The returned object is of type FObjectThumbail (see below)
14+
15+
```python
16+
thumbnail = uobject.render_thumbnail([width, height, no_flush])
17+
```
18+
19+
This function generates a new FObjectThumbail from an object. By default texture streaming is flushed after the creation of the thumbnail. By specyfing 'no_flush' the streaming will not be flushed.
20+
21+
## The FObjectThumbail object
22+
23+
This class represents a thumbnail
24+
25+
26+
The following methods are available:
27+
28+
```python
29+
width = thumbnail.get_image_width()
30+
```
31+
32+
```python
33+
height = thumbnail.get_image_height()
34+
```
35+
36+
```python
37+
# caould return zero if the thumbnail is not compressed
38+
size = thumbnail.get_compressed_data_size()
39+
```
40+
41+
```python
42+
# returns BGRA bytearray of pixels
43+
data = thumbnail.get_uncompressed_image_data()
44+
```
45+
46+
```python
47+
# if this is a newly created thumbnail, force compression
48+
thumbnail.compress_image_data()
49+
```
50+
51+
For a handy example about the thumbnail api check https://github.com/20tab/UnrealEnginePython/blob/master/examples/thumbnail_viewer.py

0 commit comments

Comments
 (0)