ccfx 1.0.4__py3-none-any.whl → 1.0.5__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 +28 -0
- {ccfx-1.0.4.dist-info → ccfx-1.0.5.dist-info}/METADATA +1 -1
- {ccfx-1.0.4.dist-info → ccfx-1.0.5.dist-info}/RECORD +6 -6
- {ccfx-1.0.4.dist-info → ccfx-1.0.5.dist-info}/WHEEL +0 -0
- {ccfx-1.0.4.dist-info → ccfx-1.0.5.dist-info}/licenses/LICENSE +0 -0
- {ccfx-1.0.4.dist-info → ccfx-1.0.5.dist-info}/top_level.txt +0 -0
ccfx/ccfx.py
CHANGED
@@ -433,6 +433,34 @@ def deleteFile(filePath:str, v:bool = False) -> bool:
|
|
433
433
|
|
434
434
|
return deleted
|
435
435
|
|
436
|
+
def removeImageColour(inPath:str, outPath:str, colour:tuple = (255, 255, 255), tolerance:int = 30):
|
437
|
+
'''
|
438
|
+
Remove a specific color from an image.
|
439
|
+
colour: RGB tuple, e.g., (255, 0, 0) for red
|
440
|
+
'''
|
441
|
+
img = Image.open(inPath)
|
442
|
+
img = img.convert("RGBA")
|
443
|
+
|
444
|
+
data = img.getdata()
|
445
|
+
|
446
|
+
new_data = []
|
447
|
+
for item in data:
|
448
|
+
# Change all pixels that match the color to transparent
|
449
|
+
if item[0] in range(colour[0]-tolerance, colour[0]+tolerance) and \
|
450
|
+
item[1] in range(colour[1]-tolerance, colour[1]+tolerance) and \
|
451
|
+
item[2] in range(colour[2]-tolerance, colour[2]+tolerance):
|
452
|
+
new_data.append((255, 255, 255, 0)) # Change to transparent
|
453
|
+
else:
|
454
|
+
new_data.append(item)
|
455
|
+
|
456
|
+
img.putdata(new_data)
|
457
|
+
img.save(outPath)
|
458
|
+
|
459
|
+
def makeTransparent(inPath:str, outPath:str, colour:tuple = (255, 255, 255), tolerance:int = 30):
|
460
|
+
'''
|
461
|
+
Make some pixels in an image transparent.
|
462
|
+
'''
|
463
|
+
removeImageColour(inPath, outPath, colour=colour, tolerance=tolerance)
|
436
464
|
|
437
465
|
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
466
|
'''
|
@@ -1,11 +1,11 @@
|
|
1
1
|
ccfx/__init__.py,sha256=UK62VcGS84SJyGVg1bK4FltZj7OkpdoyhoFWeXcKsX0,144
|
2
|
-
ccfx/ccfx.py,sha256=
|
2
|
+
ccfx/ccfx.py,sha256=PuukzvGKeuaZg-09gC_EVEqqL60snOhOs29-ld780Bk,74774
|
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.5.dist-info/licenses/LICENSE,sha256=EuxaawJg_OOCLfikkCGgfXPZmxR-x_5PH7_2e9M-3eA,1099
|
8
|
+
ccfx-1.0.5.dist-info/METADATA,sha256=ZDKztXjB8snaimpN1MY6-1TN6_6w1F9LanS7xHp_eRM,11260
|
9
|
+
ccfx-1.0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
10
|
+
ccfx-1.0.5.dist-info/top_level.txt,sha256=_cSvSA1WX2K8TgoV3iBJUdUZZqMKJbOPLNnKLYSLHaw,5
|
11
|
+
ccfx-1.0.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|