snapforge 0.1.2__tar.gz → 0.2.1__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.
- snapforge-0.2.1/PKG-INFO +85 -0
- snapforge-0.2.1/README.md +76 -0
- {snapforge-0.1.2 → snapforge-0.2.1}/pyproject.toml +2 -2
- {snapforge-0.1.2 → snapforge-0.2.1}/snapforge/__init__.py +1 -1
- {snapforge-0.1.2 → snapforge-0.2.1}/snapforge/forge.py +55 -13
- snapforge-0.2.1/snapforge.egg-info/PKG-INFO +85 -0
- {snapforge-0.1.2 → snapforge-0.2.1}/snapforge.egg-info/SOURCES.txt +1 -0
- snapforge-0.1.2/PKG-INFO +0 -8
- snapforge-0.1.2/snapforge.egg-info/PKG-INFO +0 -8
- {snapforge-0.1.2 → snapforge-0.2.1}/setup.cfg +0 -0
- {snapforge-0.1.2 → snapforge-0.2.1}/snapforge.egg-info/dependency_links.txt +0 -0
- {snapforge-0.1.2 → snapforge-0.2.1}/snapforge.egg-info/requires.txt +0 -0
- {snapforge-0.1.2 → snapforge-0.2.1}/snapforge.egg-info/top_level.txt +0 -0
snapforge-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snapforge
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Powerful and fast image editor! 😎
|
|
5
|
+
Author: Ali
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: Pillow>=9.0.0
|
|
9
|
+
|
|
10
|
+
# 📸 SnapForge
|
|
11
|
+
|
|
12
|
+
[](https://pypi.org/project/snapforge/)
|
|
13
|
+
[](https://opensource.org/licenses/MIT)
|
|
14
|
+
[](https://pypi.org/project/snapforge/)
|
|
15
|
+
|
|
16
|
+
**SnapForge** is a lightweight, fast, and intuitive Python library designed for easy image processing tasks. Whether you need to resize, convert, or manipulate images, SnapForge makes it a breeze!
|
|
17
|
+
|
|
18
|
+
## ✨ Features
|
|
19
|
+
|
|
20
|
+
- 🚀 **Fast & Lightweight**: Minimal overhead for quick image tasks.
|
|
21
|
+
- 🔄 **Format Conversion**: Easily switch between JPEG, PNG, BMP, and more.
|
|
22
|
+
- 📏 **Smart Resizing**: High-quality scaling and resizing capabilities.
|
|
23
|
+
- 🛠️ **Easy API**: Designed with developer experience in mind—simple commands for complex tasks.
|
|
24
|
+
- 🐍 **Pythonic**: Follows Python's best practices for a seamless integration.
|
|
25
|
+
|
|
26
|
+
## 📦 Installation
|
|
27
|
+
|
|
28
|
+
You can install SnapForge directly from PyPI using `pip`:
|
|
29
|
+
```bash
|
|
30
|
+
pip install snapforge
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
🚀 Quick Start
|
|
34
|
+
|
|
35
|
+
Here is a quick example to get you started with SnapForge:
|
|
36
|
+
|
|
37
|
+
import snapforge
|
|
38
|
+
|
|
39
|
+
# Load an image
|
|
40
|
+
img = snapforge.Snapforge("example.jpg")
|
|
41
|
+
|
|
42
|
+
# Resize the image
|
|
43
|
+
resized_img = img.resize(800,600)
|
|
44
|
+
|
|
45
|
+
# Convert and save the image
|
|
46
|
+
resized_img.convert("PNG").save("example_resized.png")
|
|
47
|
+
|
|
48
|
+
print("Image processed successfully!")
|
|
49
|
+
|
|
50
|
+
🧾 Feature Showcase (Full Reference)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
Here is the complete list of all available methods in SnapForge:
|
|
54
|
+
|
|
55
|
+
Category Method Description Example
|
|
56
|
+
Core .convert(fmt) Change image format (e.g., PNG, JPG) .convert("PNG")
|
|
57
|
+
.resize(w, h) Change image dimensions .resize(800, 600)
|
|
58
|
+
.optimize(q) Set compression quality (1-100) .optimize(85)
|
|
59
|
+
.save(name) Save the final forged image .save("result.jpg")
|
|
60
|
+
Lighting .apply_brightness(f) Adjust brightness(factor > 1.0 is brighter) .apply_brightness(1.2)
|
|
61
|
+
.apply_contrast(f) Adjust contrast(factor > 1.0 is higher) .apply_contrast(1.5)
|
|
62
|
+
Filters .apply_sepia() Apply a classic vintage sepia effect .apply_sepia()
|
|
63
|
+
.apply_grayscale(f) Convert to black & white (0.0 to 1.0) .apply_grayscale(1.0)
|
|
64
|
+
.apply_blur(r) Apply Gaussian blur with radius r .apply_blur(5.0)
|
|
65
|
+
.apply_sharpen() Enhance image sharpness/clarity .apply_sharpen()
|
|
66
|
+
Extras .add_watermark(p) Add a watermark image at a position .add_watermark("logo.png")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
🛠️ Requirements
|
|
70
|
+
|
|
71
|
+
Python: 3.7 or higher
|
|
72
|
+
Dependencies: Pillow
|
|
73
|
+
|
|
74
|
+
🤝 Contributing
|
|
75
|
+
|
|
76
|
+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
77
|
+
|
|
78
|
+
📜 License
|
|
79
|
+
|
|
80
|
+
Distributed under the MIT License.
|
|
81
|
+
|
|
82
|
+
👤 Author
|
|
83
|
+
|
|
84
|
+
Ali.Shm
|
|
85
|
+
Project Maintainer
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# 📸 SnapForge
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/snapforge/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://pypi.org/project/snapforge/)
|
|
6
|
+
|
|
7
|
+
**SnapForge** is a lightweight, fast, and intuitive Python library designed for easy image processing tasks. Whether you need to resize, convert, or manipulate images, SnapForge makes it a breeze!
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- 🚀 **Fast & Lightweight**: Minimal overhead for quick image tasks.
|
|
12
|
+
- 🔄 **Format Conversion**: Easily switch between JPEG, PNG, BMP, and more.
|
|
13
|
+
- 📏 **Smart Resizing**: High-quality scaling and resizing capabilities.
|
|
14
|
+
- 🛠️ **Easy API**: Designed with developer experience in mind—simple commands for complex tasks.
|
|
15
|
+
- 🐍 **Pythonic**: Follows Python's best practices for a seamless integration.
|
|
16
|
+
|
|
17
|
+
## 📦 Installation
|
|
18
|
+
|
|
19
|
+
You can install SnapForge directly from PyPI using `pip`:
|
|
20
|
+
```bash
|
|
21
|
+
pip install snapforge
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
🚀 Quick Start
|
|
25
|
+
|
|
26
|
+
Here is a quick example to get you started with SnapForge:
|
|
27
|
+
|
|
28
|
+
import snapforge
|
|
29
|
+
|
|
30
|
+
# Load an image
|
|
31
|
+
img = snapforge.Snapforge("example.jpg")
|
|
32
|
+
|
|
33
|
+
# Resize the image
|
|
34
|
+
resized_img = img.resize(800,600)
|
|
35
|
+
|
|
36
|
+
# Convert and save the image
|
|
37
|
+
resized_img.convert("PNG").save("example_resized.png")
|
|
38
|
+
|
|
39
|
+
print("Image processed successfully!")
|
|
40
|
+
|
|
41
|
+
🧾 Feature Showcase (Full Reference)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
Here is the complete list of all available methods in SnapForge:
|
|
45
|
+
|
|
46
|
+
Category Method Description Example
|
|
47
|
+
Core .convert(fmt) Change image format (e.g., PNG, JPG) .convert("PNG")
|
|
48
|
+
.resize(w, h) Change image dimensions .resize(800, 600)
|
|
49
|
+
.optimize(q) Set compression quality (1-100) .optimize(85)
|
|
50
|
+
.save(name) Save the final forged image .save("result.jpg")
|
|
51
|
+
Lighting .apply_brightness(f) Adjust brightness(factor > 1.0 is brighter) .apply_brightness(1.2)
|
|
52
|
+
.apply_contrast(f) Adjust contrast(factor > 1.0 is higher) .apply_contrast(1.5)
|
|
53
|
+
Filters .apply_sepia() Apply a classic vintage sepia effect .apply_sepia()
|
|
54
|
+
.apply_grayscale(f) Convert to black & white (0.0 to 1.0) .apply_grayscale(1.0)
|
|
55
|
+
.apply_blur(r) Apply Gaussian blur with radius r .apply_blur(5.0)
|
|
56
|
+
.apply_sharpen() Enhance image sharpness/clarity .apply_sharpen()
|
|
57
|
+
Extras .add_watermark(p) Add a watermark image at a position .add_watermark("logo.png")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
🛠️ Requirements
|
|
61
|
+
|
|
62
|
+
Python: 3.7 or higher
|
|
63
|
+
Dependencies: Pillow
|
|
64
|
+
|
|
65
|
+
🤝 Contributing
|
|
66
|
+
|
|
67
|
+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
68
|
+
|
|
69
|
+
📜 License
|
|
70
|
+
|
|
71
|
+
Distributed under the MIT License.
|
|
72
|
+
|
|
73
|
+
👤 Author
|
|
74
|
+
|
|
75
|
+
Ali.Shm
|
|
76
|
+
Project Maintainer
|
|
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "snapforge"
|
|
7
|
-
version = "0.1
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "Powerful and fast image editor! 😎"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name="Ali"},
|
|
11
11
|
]
|
|
12
|
-
readme = "README.md"
|
|
12
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
13
13
|
requires-python = ">=3.7"
|
|
14
14
|
dependencies = [
|
|
15
15
|
"Pillow>=9.0.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from PIL import Image, ImageEnhance, ImageOps
|
|
1
|
+
from PIL import Image, ImageEnhance, ImageOps, ImageFilter
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
class SnapForge:
|
|
@@ -10,9 +10,10 @@ class SnapForge:
|
|
|
10
10
|
raise FileNotFoundError(f"❌ Error: The specified file path does not exist: '{image_path}'")
|
|
11
11
|
|
|
12
12
|
try:
|
|
13
|
-
self.image = Image.open(image_path).convert("RGB")
|
|
13
|
+
self.image = Image.open(image_path).convert("RGB")
|
|
14
14
|
self.original_format = self.image.format
|
|
15
15
|
self.target_format = self.original_format if self.original_format else "JPEG"
|
|
16
|
+
self.quality = 85 # Default quality
|
|
16
17
|
print(f"🚀 Success: Image loaded successfully. Original format: {self.target_format}")
|
|
17
18
|
except Exception as e:
|
|
18
19
|
raise IOError(f"❌ Error: Failed to open the image. Details: {e}")
|
|
@@ -39,21 +40,62 @@ class SnapForge:
|
|
|
39
40
|
print(f"✨ Success: Optimization mode enabled (Quality: {quality}%)")
|
|
40
41
|
return self
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
# --- NEW FEATURES ADDED BELOW ---
|
|
44
|
+
|
|
45
|
+
def apply_brightness(self, factor: float):
|
|
46
|
+
""" 😎 Light it up or dim it down! 😎
|
|
47
|
+
factor: 1.0 is original, < 1.0 is darker, > 1.0 is brighter
|
|
48
|
+
"""
|
|
49
|
+
enhancer = ImageEnhance.Brightness(self.image)
|
|
50
|
+
self.image = enhancer.enhance(factor)
|
|
51
|
+
print(f"☀️ Success: Brightness adjusted by factor {factor}")
|
|
52
|
+
return self
|
|
53
|
+
|
|
54
|
+
def apply_contrast(self, factor: float):
|
|
55
|
+
""" 😎 Pop those colors! 😎
|
|
56
|
+
factor: 1.0 is original, < 1.0 is lower contrast, > 1.0 is higher contrast
|
|
46
57
|
"""
|
|
58
|
+
enhancer = ImageEnhance.Contrast(self.image)
|
|
59
|
+
self.image = enhancer.enhance(factor)
|
|
60
|
+
print(f"🌗 Success: Contrast adjusted by factor {factor}")
|
|
61
|
+
return self
|
|
62
|
+
|
|
63
|
+
def apply_sepia(self):
|
|
64
|
+
""" 😎 Just like old cameras! (Sepia Filter) 😎 """
|
|
65
|
+
# Applying sepia via color transformation
|
|
66
|
+
width, height = self.image.size
|
|
67
|
+
pixels = self.image.load()
|
|
68
|
+
for py in range(height):
|
|
69
|
+
for px in range(width):
|
|
70
|
+
r, g, b = pixels[px, py]
|
|
71
|
+
# Standard Sepia formula
|
|
72
|
+
tr = int(0.393 * r + 0.769 * g + 0.189 * b)
|
|
73
|
+
tg = int(0.349 * r + 0.686 * g + 0.168 * b)
|
|
74
|
+
tb = int(0.272 * r + 0.534 * g + 0.131 * b)
|
|
75
|
+
pixels[px, py] = (min(tr, 255), min(tg, 255), min(tb, 255))
|
|
76
|
+
print(f"📜 Success: Sepia effect applied!")
|
|
77
|
+
return self
|
|
78
|
+
|
|
79
|
+
def apply_blur(self, radius: float):
|
|
80
|
+
""" 😎 Make it dreamy! 😎 """
|
|
81
|
+
self.image = self.image.filter(ImageFilter.GaussianBlur(radius))
|
|
82
|
+
print(f"☁️ Success: Blur applied with radius {radius}")
|
|
83
|
+
return self
|
|
84
|
+
|
|
85
|
+
def apply_sharpen(self):
|
|
86
|
+
""" 😎 Make it crisp! 😎 """
|
|
87
|
+
self.image = self.image.filter(ImageFilter.SHARPEN)
|
|
88
|
+
print(f"🎯 Success: Image sharpened!")
|
|
89
|
+
return self
|
|
90
|
+
|
|
91
|
+
# --- END OF NEW FEATURES ---
|
|
92
|
+
|
|
93
|
+
def apply_grayscale(self, factor: float = 1.0):
|
|
94
|
+
""" 😎 Make it moody! 😎 """
|
|
47
95
|
if not (0.0 <= factor <= 1.0):
|
|
48
96
|
raise ValueError("❌ Error: Factor must be between 0.0 and 1.0")
|
|
49
|
-
|
|
50
|
-
# ایجاد نسخه سیاه و سفید
|
|
51
97
|
grayscale_image = ImageOps.grayscale(self.image).convert("RGB")
|
|
52
|
-
|
|
53
|
-
# ترکیب تصویر اصلی با تصویر سیاه و سفید بر اساس فاکتور
|
|
54
|
-
# فرمول: Result = Image * (1 - factor) + Grayscale * factor
|
|
55
98
|
self.image = Image.blend(self.image, grayscale_image, factor)
|
|
56
|
-
|
|
57
99
|
print(f"🌑 Success: Grayscale effect applied with factor {factor}")
|
|
58
100
|
return self
|
|
59
101
|
|
|
@@ -80,7 +122,7 @@ class SnapForge:
|
|
|
80
122
|
|
|
81
123
|
save_kwargs = {"optimize": True}
|
|
82
124
|
if self.target_format in ["JPEG", "JPG"]:
|
|
83
|
-
save_kwargs["quality"] =
|
|
125
|
+
save_kwargs["quality"] = self.quality
|
|
84
126
|
|
|
85
127
|
self.image.save(output_name, **save_kwargs)
|
|
86
128
|
print(f"🎉 Success: Image forged and saved as '{output_name}' 🎉")
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snapforge
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Powerful and fast image editor! 😎
|
|
5
|
+
Author: Ali
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: Pillow>=9.0.0
|
|
9
|
+
|
|
10
|
+
# 📸 SnapForge
|
|
11
|
+
|
|
12
|
+
[](https://pypi.org/project/snapforge/)
|
|
13
|
+
[](https://opensource.org/licenses/MIT)
|
|
14
|
+
[](https://pypi.org/project/snapforge/)
|
|
15
|
+
|
|
16
|
+
**SnapForge** is a lightweight, fast, and intuitive Python library designed for easy image processing tasks. Whether you need to resize, convert, or manipulate images, SnapForge makes it a breeze!
|
|
17
|
+
|
|
18
|
+
## ✨ Features
|
|
19
|
+
|
|
20
|
+
- 🚀 **Fast & Lightweight**: Minimal overhead for quick image tasks.
|
|
21
|
+
- 🔄 **Format Conversion**: Easily switch between JPEG, PNG, BMP, and more.
|
|
22
|
+
- 📏 **Smart Resizing**: High-quality scaling and resizing capabilities.
|
|
23
|
+
- 🛠️ **Easy API**: Designed with developer experience in mind—simple commands for complex tasks.
|
|
24
|
+
- 🐍 **Pythonic**: Follows Python's best practices for a seamless integration.
|
|
25
|
+
|
|
26
|
+
## 📦 Installation
|
|
27
|
+
|
|
28
|
+
You can install SnapForge directly from PyPI using `pip`:
|
|
29
|
+
```bash
|
|
30
|
+
pip install snapforge
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
🚀 Quick Start
|
|
34
|
+
|
|
35
|
+
Here is a quick example to get you started with SnapForge:
|
|
36
|
+
|
|
37
|
+
import snapforge
|
|
38
|
+
|
|
39
|
+
# Load an image
|
|
40
|
+
img = snapforge.Snapforge("example.jpg")
|
|
41
|
+
|
|
42
|
+
# Resize the image
|
|
43
|
+
resized_img = img.resize(800,600)
|
|
44
|
+
|
|
45
|
+
# Convert and save the image
|
|
46
|
+
resized_img.convert("PNG").save("example_resized.png")
|
|
47
|
+
|
|
48
|
+
print("Image processed successfully!")
|
|
49
|
+
|
|
50
|
+
🧾 Feature Showcase (Full Reference)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
Here is the complete list of all available methods in SnapForge:
|
|
54
|
+
|
|
55
|
+
Category Method Description Example
|
|
56
|
+
Core .convert(fmt) Change image format (e.g., PNG, JPG) .convert("PNG")
|
|
57
|
+
.resize(w, h) Change image dimensions .resize(800, 600)
|
|
58
|
+
.optimize(q) Set compression quality (1-100) .optimize(85)
|
|
59
|
+
.save(name) Save the final forged image .save("result.jpg")
|
|
60
|
+
Lighting .apply_brightness(f) Adjust brightness(factor > 1.0 is brighter) .apply_brightness(1.2)
|
|
61
|
+
.apply_contrast(f) Adjust contrast(factor > 1.0 is higher) .apply_contrast(1.5)
|
|
62
|
+
Filters .apply_sepia() Apply a classic vintage sepia effect .apply_sepia()
|
|
63
|
+
.apply_grayscale(f) Convert to black & white (0.0 to 1.0) .apply_grayscale(1.0)
|
|
64
|
+
.apply_blur(r) Apply Gaussian blur with radius r .apply_blur(5.0)
|
|
65
|
+
.apply_sharpen() Enhance image sharpness/clarity .apply_sharpen()
|
|
66
|
+
Extras .add_watermark(p) Add a watermark image at a position .add_watermark("logo.png")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
🛠️ Requirements
|
|
70
|
+
|
|
71
|
+
Python: 3.7 or higher
|
|
72
|
+
Dependencies: Pillow
|
|
73
|
+
|
|
74
|
+
🤝 Contributing
|
|
75
|
+
|
|
76
|
+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
77
|
+
|
|
78
|
+
📜 License
|
|
79
|
+
|
|
80
|
+
Distributed under the MIT License.
|
|
81
|
+
|
|
82
|
+
👤 Author
|
|
83
|
+
|
|
84
|
+
Ali.Shm
|
|
85
|
+
Project Maintainer
|
snapforge-0.1.2/PKG-INFO
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|