kenenet 1.1.6__py3-none-any.whl → 1.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kenenet/__init__.py +14 -5
- {kenenet-1.1.6.dist-info → kenenet-1.1.8.dist-info}/METADATA +1 -1
- kenenet-1.1.8.dist-info/RECORD +5 -0
- kenenet-1.1.6.dist-info/RECORD +0 -5
- {kenenet-1.1.6.dist-info → kenenet-1.1.8.dist-info}/WHEEL +0 -0
- {kenenet-1.1.6.dist-info → kenenet-1.1.8.dist-info}/top_level.txt +0 -0
kenenet/__init__.py
CHANGED
@@ -186,24 +186,33 @@ def save_img(img, name=' ', reset=True, file='temp_screenshots', mute=False):
|
|
186
186
|
if os.path.exists(file):
|
187
187
|
if reset and ospid is None:
|
188
188
|
zhmiscellany.fileio.empty_directory(file)
|
189
|
-
quick_print(f'Cleaned folder {file}')
|
189
|
+
if not mute: quick_print(f'Cleaned folder {file}')
|
190
190
|
else:
|
191
191
|
quick_print(f'New folder created {file}')
|
192
|
-
zhmiscellany.fileio.create_folder(file)
|
192
|
+
if not mute: zhmiscellany.fileio.create_folder(file)
|
193
193
|
ospid = True
|
194
194
|
frame = inspect.currentframe().f_back
|
195
195
|
lineno = frame.f_lineno
|
196
196
|
if isinstance(img, np.ndarray):
|
197
|
+
# detect mask arrays: floating-point, single-channel
|
198
|
+
is_mask = img.dtype.kind == 'f' and (img.ndim == 2 or (img.ndim == 3 and img.shape[-1] == 1))
|
197
199
|
save_name = name + f'{time.time()}'
|
198
|
-
|
199
|
-
|
200
|
-
|
200
|
+
if is_mask:
|
201
|
+
# scale mask values [0.0,1.0] to [0,255] grayscale
|
202
|
+
mask_uint8 = (img.squeeze() * 255).clip(0,255).astype(np.uint8)
|
203
|
+
img_to_save = Image.fromarray(mask_uint8)
|
204
|
+
else:
|
205
|
+
img_to_save = Image.fromarray(img)
|
206
|
+
img_to_save.save(fr'{file}\{save_name}.png')
|
207
|
+
if not mute:
|
208
|
+
quick_print(f'Saved image as {save_name}', lineno)
|
201
209
|
else:
|
202
210
|
quick_print(f"Your img is not a fucking numpy array you twat, couldn't save {name}", lineno)
|
203
211
|
|
204
212
|
|
205
213
|
|
206
214
|
|
215
|
+
|
207
216
|
class _load_audio:
|
208
217
|
def __init__(self):
|
209
218
|
pygame.mixer.init()
|
@@ -0,0 +1,5 @@
|
|
1
|
+
kenenet/__init__.py,sha256=wuv2RfvLgHl7TacGdyUVDpfzIhKdNKKfGBU1dUXrKqI,21607
|
2
|
+
kenenet-1.1.8.dist-info/METADATA,sha256=1bYhd3iloCZLoOxHEq2f3RbT--rJPcN-fTcWMUrpNKk,1693
|
3
|
+
kenenet-1.1.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
+
kenenet-1.1.8.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
+
kenenet-1.1.8.dist-info/RECORD,,
|
kenenet-1.1.6.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
kenenet/__init__.py,sha256=ZKpvVSipCdEwYO2zzJCq--ZPkALvoD8niQkZbUE299Y,21149
|
2
|
-
kenenet-1.1.6.dist-info/METADATA,sha256=U-QjxxpfYTKPuoJy9JeFGq8WAfpa2_W7iP49P1gu6UY,1693
|
3
|
-
kenenet-1.1.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
-
kenenet-1.1.6.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
-
kenenet-1.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|