ccfx 1.0.4__tar.gz → 1.0.6__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ccfx
3
- Version: 1.0.4
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
@@ -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.4
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
@@ -13,3 +13,4 @@ py7zr
13
13
  mutagen
14
14
  requests
15
15
  tqdm
16
+ pillow
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ccfx"
7
- version = "1.0.4"
7
+ version = "1.0.6"
8
8
  description = "This package simplifies regular common actions for quick prototyping in a user friendly way"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -30,6 +30,7 @@ dependencies = [
30
30
  "mutagen",
31
31
  "requests",
32
32
  "tqdm",
33
+ "pillow",
33
34
  ]
34
35
 
35
36
  [project.urls]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes