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 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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ccfx
3
- Version: 1.0.4
3
+ Version: 1.0.5
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
@@ -1,11 +1,11 @@
1
1
  ccfx/__init__.py,sha256=UK62VcGS84SJyGVg1bK4FltZj7OkpdoyhoFWeXcKsX0,144
2
- ccfx/ccfx.py,sha256=CmFUpD93sMYNd7LzLGUa56a9Acz-m0LCcIVpZOYG-j8,73719
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.4.dist-info/licenses/LICENSE,sha256=EuxaawJg_OOCLfikkCGgfXPZmxR-x_5PH7_2e9M-3eA,1099
8
- ccfx-1.0.4.dist-info/METADATA,sha256=cvUn0gfEDQveMIV1wVSjNG-RiFSxw3sc19K_ZuKTuwc,11260
9
- ccfx-1.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- ccfx-1.0.4.dist-info/top_level.txt,sha256=_cSvSA1WX2K8TgoV3iBJUdUZZqMKJbOPLNnKLYSLHaw,5
11
- ccfx-1.0.4.dist-info/RECORD,,
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