ccfx 1.0.4__py3-none-any.whl → 1.0.6__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.
- ccfx/ccfx.py +29 -0
- {ccfx-1.0.4.dist-info → ccfx-1.0.6.dist-info}/METADATA +2 -1
- {ccfx-1.0.4.dist-info → ccfx-1.0.6.dist-info}/RECORD +6 -6
- {ccfx-1.0.4.dist-info → ccfx-1.0.6.dist-info}/WHEEL +0 -0
- {ccfx-1.0.4.dist-info → ccfx-1.0.6.dist-info}/licenses/LICENSE +0 -0
- {ccfx-1.0.4.dist-info → ccfx-1.0.6.dist-info}/top_level.txt +0 -0
ccfx/ccfx.py
CHANGED
@@ -37,6 +37,7 @@ from tqdm import tqdm
|
|
37
37
|
import yt_dlp
|
38
38
|
from typing import Optional
|
39
39
|
from datetime import datetime, timedelta
|
40
|
+
from PIL import Image
|
40
41
|
|
41
42
|
# functions
|
42
43
|
def listFiles(path: str, ext: Optional[str] = None) -> list:
|
@@ -433,6 +434,34 @@ def deleteFile(filePath:str, v:bool = False) -> bool:
|
|
433
434
|
|
434
435
|
return deleted
|
435
436
|
|
437
|
+
def removeImageColour(inPath:str, outPath:str, colour:tuple = (255, 255, 255), tolerance:int = 30):
|
438
|
+
'''
|
439
|
+
Remove a specific color from an image.
|
440
|
+
colour: RGB tuple, e.g., (255, 0, 0) for red
|
441
|
+
'''
|
442
|
+
img = Image.open(inPath)
|
443
|
+
img = img.convert("RGBA")
|
444
|
+
|
445
|
+
data = img.getdata()
|
446
|
+
|
447
|
+
new_data = []
|
448
|
+
for item in data:
|
449
|
+
# Change all pixels that match the color to transparent
|
450
|
+
if item[0] in range(colour[0]-tolerance, colour[0]+tolerance) and \
|
451
|
+
item[1] in range(colour[1]-tolerance, colour[1]+tolerance) and \
|
452
|
+
item[2] in range(colour[2]-tolerance, colour[2]+tolerance):
|
453
|
+
new_data.append((255, 255, 255, 0)) # Change to transparent
|
454
|
+
else:
|
455
|
+
new_data.append(item)
|
456
|
+
|
457
|
+
img.putdata(new_data)
|
458
|
+
img.save(outPath)
|
459
|
+
|
460
|
+
def makeTransparent(inPath:str, outPath:str, colour:tuple = (255, 255, 255), tolerance:int = 30):
|
461
|
+
'''
|
462
|
+
Make some pixels in an image transparent.
|
463
|
+
'''
|
464
|
+
removeImageColour(inPath, outPath, colour=colour, tolerance=tolerance)
|
436
465
|
|
437
466
|
def alert(message:str, server:str = "http://ntfy.sh", topic:str = "pythonAlerts", attachment:Optional[str] = None, messageTitle:str = "info", priority:int = None, tags:list = [], printIt:bool = True, v:bool = False) -> bool:
|
438
467
|
'''
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ccfx
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.6
|
4
4
|
Summary: This package simplifies regular common actions for quick prototyping in a user friendly way
|
5
5
|
Author-email: Celray James CHAWANDA <celray@chawanda.com>
|
6
6
|
License-Expression: MIT
|
@@ -25,6 +25,7 @@ Requires-Dist: py7zr
|
|
25
25
|
Requires-Dist: mutagen
|
26
26
|
Requires-Dist: requests
|
27
27
|
Requires-Dist: tqdm
|
28
|
+
Requires-Dist: pillow
|
28
29
|
Dynamic: license-file
|
29
30
|
|
30
31
|
# ccfx
|
@@ -1,11 +1,11 @@
|
|
1
1
|
ccfx/__init__.py,sha256=UK62VcGS84SJyGVg1bK4FltZj7OkpdoyhoFWeXcKsX0,144
|
2
|
-
ccfx/ccfx.py,sha256=
|
2
|
+
ccfx/ccfx.py,sha256=5QDGMoGiCmMyQ7Nnfp4UpOa_qxx8C6_wJuYwblsTx_4,74797
|
3
3
|
ccfx/excel.py,sha256=vm_cm4huKKx4_Nstr5neJzhBLmoZjg8qxjzz4hcF5hg,4754
|
4
4
|
ccfx/mssqlConnection.py,sha256=C3HxzgZHmHy_de9EbMaXzR8NrkJxwHc8a00qzxQu_gs,8984
|
5
5
|
ccfx/sqliteConnection.py,sha256=jEJ94D5ySt84N7AeDpa27Rclt1NaKhkX6nYzidwApIg,11104
|
6
6
|
ccfx/word.py,sha256=AGa64jX5Zl5qotZh5L0QmrsjTnktIBhmj_ByRKZ88vw,3061
|
7
|
-
ccfx-1.0.
|
8
|
-
ccfx-1.0.
|
9
|
-
ccfx-1.0.
|
10
|
-
ccfx-1.0.
|
11
|
-
ccfx-1.0.
|
7
|
+
ccfx-1.0.6.dist-info/licenses/LICENSE,sha256=EuxaawJg_OOCLfikkCGgfXPZmxR-x_5PH7_2e9M-3eA,1099
|
8
|
+
ccfx-1.0.6.dist-info/METADATA,sha256=0UoiJQWqaTeo9Qm0klfMU6X3Bcq5hqLIz8LZyjjLyxc,11282
|
9
|
+
ccfx-1.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
10
|
+
ccfx-1.0.6.dist-info/top_level.txt,sha256=_cSvSA1WX2K8TgoV3iBJUdUZZqMKJbOPLNnKLYSLHaw,5
|
11
|
+
ccfx-1.0.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|