|
1 | 1 | # Convert |
2 | 2 |
|
3 | | -[Tstickers Index](../README.md#tstickers-index) / |
4 | | -[Tstickers](./index.md#tstickers) / |
5 | | -Convert |
| 3 | +[Tstickers Index](../README.md#tstickers-index) / [Tstickers](./index.md#tstickers) / Convert |
6 | 4 |
|
7 | 5 | > Auto-generated documentation for [tstickers.convert](../../../tstickers/convert.py) module. |
8 | 6 |
|
9 | 7 | - [Convert](#convert) |
| 8 | + - [Backend](#backend) |
10 | 9 | - [assureDirExists](#assuredirexists) |
11 | | - - [convertTgs](#converttgs) |
12 | | - - [convertWebp](#convertwebp) |
| 10 | + - [convertAnimated](#convertanimated) |
| 11 | + - [convertFunc](#convertfunc) |
| 12 | + - [convertStatic](#convertstatic) |
13 | 13 | - [convertWithPIL](#convertwithpil) |
14 | 14 |
|
| 15 | +## Backend |
| 16 | + |
| 17 | +[Show source in convert.py:15](../../../tstickers/convert.py#L15) |
| 18 | + |
| 19 | +#### Signature |
| 20 | + |
| 21 | +```python |
| 22 | +class Backend(IntEnum): ... |
| 23 | +``` |
| 24 | + |
| 25 | + |
| 26 | + |
15 | 27 | ## assureDirExists |
16 | 28 |
|
17 | | -[Show source in convert.py:13](../../../tstickers/convert.py#L13) |
| 29 | +[Show source in convert.py:33](../../../tstickers/convert.py#L33) |
18 | 30 |
|
19 | | -make the dir if not exists |
| 31 | +Make the dir if not exists. |
20 | 32 |
|
21 | 33 | #### Arguments |
22 | 34 |
|
23 | | -- `root` *Path* - the path of the root directory |
24 | | -- `directory` *Path|str* - the directory name |
| 35 | +---- |
| 36 | + - `root` *Path* - the path of the root directory |
| 37 | + - `directory` *Path|str* - the directory name |
25 | 38 |
|
26 | 39 | #### Returns |
27 | 40 |
|
28 | | -- `Path` - the full path |
| 41 | +------- |
| 42 | + - `Path` - the full path |
29 | 43 |
|
30 | 44 | #### Signature |
31 | 45 |
|
32 | 46 | ```python |
33 | | -def assureDirExists(root: Path, directory: Path | str) -> Path: |
34 | | - ... |
| 47 | +def assureDirExists(root: Path, directory: Path | str) -> Path: ... |
35 | 48 | ``` |
36 | 49 |
|
37 | 50 |
|
38 | 51 |
|
39 | | -## convertTgs |
| 52 | +## convertAnimated |
40 | 53 |
|
41 | | -[Show source in convert.py:72](../../../tstickers/convert.py#L72) |
| 54 | +[Show source in convert.py:101](../../../tstickers/convert.py#L101) |
42 | 55 |
|
43 | | -Convert animated stickers to webp, gif and png |
| 56 | +Convert animated stickers to webp, gif and png. |
44 | 57 |
|
45 | 58 | #### Arguments |
46 | 59 |
|
47 | | -- `swd` *Path* - the sticker working directory (downloads/packName) |
48 | | -- `threads` *int, optional* - number of threads to pass to ThreadPoolExecutor. Defaults to 4. |
49 | | -- `frameSkip` *int, optional* - skip n number of frames in the interest of |
50 | | -optimisation with a quality trade-off. Defaults to 1. |
51 | | -- `scale` *float, optional* - upscale/ downscale the images produced. Intended |
52 | | -for optimisation with a quality trade-off. Defaults to 1. |
| 60 | +---- |
| 61 | + - `swd` *Path* - the sticker working directory (downloads/packName) |
| 62 | + - `threads` *int, optional* - number of threads to pass to ThreadPoolExecutor. Defaults to number of cores/ logical processors. |
| 63 | + - `frameSkip` *int, optional* - skip n number of frames in the interest of |
| 64 | + optimisation with a quality trade-off. Defaults to 1. |
| 65 | + - `scale` *float, optional* - upscale/ downscale the images produced. Intended |
| 66 | + for optimisation with a quality trade-off. Defaults to 1. |
53 | 67 |
|
54 | 68 | #### Returns |
55 | 69 |
|
56 | | -- `int` - number of stickers successfully converted |
| 70 | +------- |
| 71 | + - `int` - number of stickers successfully converted |
57 | 72 |
|
58 | 73 | #### Signature |
59 | 74 |
|
60 | 75 | ```python |
61 | | -def convertTgs(swd: Path, threads: int = 4, frameSkip: int = 1, scale: float = 1) -> int: |
62 | | - ... |
| 76 | +def convertAnimated( |
| 77 | + swd: Path, |
| 78 | + threads: int = multiprocessing.cpu_count(), |
| 79 | + frameSkip: int = 1, |
| 80 | + scale: float = 1, |
| 81 | + backend: Backend = Backend.UNDEFINED, |
| 82 | +) -> int: ... |
63 | 83 | ``` |
64 | 84 |
|
| 85 | +#### See also |
65 | 86 |
|
| 87 | +- [Backend](#backend) |
66 | 88 |
|
67 | | -## convertWebp |
68 | 89 |
|
69 | | -[Show source in convert.py:44](../../../tstickers/convert.py#L44) |
70 | 90 |
|
71 | | -Convert static stickers to png and gif |
| 91 | +## convertFunc |
| 92 | + |
| 93 | +[Show source in convert.py:21](../../../tstickers/convert.py#L21) |
| 94 | + |
| 95 | +#### Signature |
| 96 | + |
| 97 | +```python |
| 98 | +def convertFunc(_x, _y, _z, _a) -> int: ... |
| 99 | +``` |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | +## convertStatic |
| 104 | + |
| 105 | +[Show source in convert.py:70](../../../tstickers/convert.py#L70) |
| 106 | + |
| 107 | +Convert static stickers to png and gif. |
72 | 108 |
|
73 | 109 | #### Arguments |
74 | 110 |
|
75 | | -- `swd` *Path* - the sticker working directory (downloads/packName) |
76 | | -- `threads` *int, optional* - number of threads to pass to ThreadPoolExecutor. Defaults to 4. |
| 111 | +---- |
| 112 | + - `swd` *Path* - the sticker working directory (downloads/packName) |
| 113 | + - `threads` *int, optional* - number of threads to pass to ThreadPoolExecutor. Defaults to 4. |
77 | 114 |
|
78 | 115 | #### Returns |
79 | 116 |
|
80 | | -- `int` - number of stickers successfully converted |
| 117 | +------- |
| 118 | + - `int` - number of stickers successfully converted |
81 | 119 |
|
82 | 120 | #### Signature |
83 | 121 |
|
84 | 122 | ```python |
85 | | -def convertWebp(swd: Path, threads: int = 4) -> int: |
86 | | - ... |
| 123 | +def convertStatic(swd: Path, threads: int = 4) -> int: ... |
87 | 124 | ``` |
88 | 125 |
|
89 | 126 |
|
90 | 127 |
|
91 | 128 | ## convertWithPIL |
92 | 129 |
|
93 | | -[Show source in convert.py:27](../../../tstickers/convert.py#L27) |
| 130 | +[Show source in convert.py:50](../../../tstickers/convert.py#L50) |
94 | 131 |
|
95 | | -Convert the webp file to png |
| 132 | +Convert the webp file to png. |
96 | 133 |
|
97 | 134 | #### Arguments |
98 | 135 |
|
99 | | -- `inputFile` *str* - path to input file |
| 136 | +---- |
| 137 | + - `inputFile` *str* - path to input file |
100 | 138 |
|
101 | 139 | #### Returns |
102 | 140 |
|
103 | | -- `str` - path to input file |
| 141 | +------- |
| 142 | + - `str` - path to input file |
104 | 143 |
|
105 | 144 | #### Signature |
106 | 145 |
|
107 | 146 | ```python |
108 | | -def convertWithPIL(inputFile: str) -> str: |
109 | | - ... |
110 | | -``` |
111 | | - |
112 | | - |
| 147 | +def convertWithPIL(inputFile: str) -> str: ... |
| 148 | +``` |
0 commit comments