snapforge 1.3.0__tar.gz → 2.0.0__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-2.0.0/PKG-INFO +178 -0
- snapforge-2.0.0/README.md +167 -0
- {snapforge-1.3.0 → snapforge-2.0.0}/pyproject.toml +4 -2
- {snapforge-1.3.0 → snapforge-2.0.0}/snapforge/__init__.py +1 -1
- {snapforge-1.3.0 → snapforge-2.0.0}/snapforge/forge.py +50 -18
- snapforge-2.0.0/snapforge.egg-info/PKG-INFO +178 -0
- snapforge-2.0.0/snapforge.egg-info/requires.txt +3 -0
- snapforge-1.3.0/PKG-INFO +0 -96
- snapforge-1.3.0/README.md +0 -87
- snapforge-1.3.0/snapforge.egg-info/PKG-INFO +0 -96
- snapforge-1.3.0/snapforge.egg-info/requires.txt +0 -1
- {snapforge-1.3.0 → snapforge-2.0.0}/setup.cfg +0 -0
- {snapforge-1.3.0 → snapforge-2.0.0}/snapforge.egg-info/SOURCES.txt +0 -0
- {snapforge-1.3.0 → snapforge-2.0.0}/snapforge.egg-info/dependency_links.txt +0 -0
- {snapforge-1.3.0 → snapforge-2.0.0}/snapforge.egg-info/top_level.txt +0 -0
snapforge-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snapforge
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Powerful and fast image editor! 😎
|
|
5
|
+
Author: Ali.Shm
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: Pillow>=9.0.0
|
|
9
|
+
Requires-Dist: requests>=2.25.0
|
|
10
|
+
Requires-Dist: packaging>=20.0
|
|
11
|
+
|
|
12
|
+
# 📸 SnapForge
|
|
13
|
+
|
|
14
|
+
[](...)
|
|
15
|
+
[](...)
|
|
16
|
+
[](...)
|
|
17
|
+
[](...)
|
|
18
|
+
[](...)
|
|
19
|
+
[](...)
|
|
20
|
+
|
|
21
|
+
> **Forge your images with a single chain of commands.**
|
|
22
|
+
|
|
23
|
+
A lightweight, fast and intuitive Python library for image processing built on top of Pillow.
|
|
24
|
+
|
|
25
|
+
Perfect for resizing, filtering, enhancing and transforming images with a clean, chainable API.
|
|
26
|
+
|
|
27
|
+
## ✨ Features
|
|
28
|
+
|
|
29
|
+
- 🚀 **Fast & Lightweight**: Minimal overhead for quick image tasks.
|
|
30
|
+
|
|
31
|
+
- 🔄 **Format Conversion**: Easily switch between JPEG, PNG, BMP, and more.
|
|
32
|
+
|
|
33
|
+
- 📏 **Smart Resizing**: High-quality scaling and resizing capabilities.
|
|
34
|
+
|
|
35
|
+
- 🛠️ **Easy API**: Designed with developer experience in mind—simple commands for complex tasks.
|
|
36
|
+
|
|
37
|
+
- 🐍 **Pythonic**: Follows Python's best practices for a seamless integration.
|
|
38
|
+
|
|
39
|
+
- 🔗 **Chainable API**: Build powerful image processing pipelines with clean and readable method chaining.
|
|
40
|
+
|
|
41
|
+
- 📷 **Powered by Pillow**: Uses the trusted Pillow library for reliable image processing.
|
|
42
|
+
|
|
43
|
+
- ⚡ **Efficient Processing**: Designed for smooth and practical image manipulation workflows.
|
|
44
|
+
|
|
45
|
+
- 🧾 **MIT License**: Open-source and free to use in personal and commercial projects.
|
|
46
|
+
|
|
47
|
+
## 📦 Installation
|
|
48
|
+
|
|
49
|
+
You can install SnapForge directly from PyPI using `pip`:
|
|
50
|
+
```bash
|
|
51
|
+
pip install snapforge
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 🚀 Quick Start
|
|
55
|
+
|
|
56
|
+
Here is a quick example to get you started with SnapForge:
|
|
57
|
+
```bash
|
|
58
|
+
from snapforge import SnapForge
|
|
59
|
+
|
|
60
|
+
(
|
|
61
|
+
SnapForge("photo.jpg")
|
|
62
|
+
.resize(800, 600)
|
|
63
|
+
.apply_grayscale(1.0)
|
|
64
|
+
.add_text("SnapForge", (30, 30))
|
|
65
|
+
.optimize(85)
|
|
66
|
+
.save("result.jpg")
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
print("Image processed successfully!")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
# 📦 Available Methods
|
|
73
|
+
Here is the complete list of all available methods in SnapForge:
|
|
74
|
+
|
|
75
|
+
### ⚙️ Core
|
|
76
|
+
|
|
77
|
+
| Method | Description | Example |
|
|
78
|
+
|:------|:------------|:--------|
|
|
79
|
+
| `.convert(fmt)` | Change image format (PNG, JPG, WEBP...) | `.convert("PNG")` |
|
|
80
|
+
| `.resize(w, h)` | Change image dimensions | `.resize(800, 600)` |
|
|
81
|
+
| `.thumbnail(w, h)` | Resize while keeping aspect ratio | `.thumbnail(500, 500)` |
|
|
82
|
+
| `.fit(w, h)` | Resize and crop to exact dimensions | `.fit(1080, 1080)` |
|
|
83
|
+
| `.crop(l, t, r, b)` | Crop image | `.crop(0,0,100,100)` |
|
|
84
|
+
| `.rotate(a)` | Rotate image | `.rotate(90)` |
|
|
85
|
+
| `.optimize(q)` | Set JPEG quality | `.optimize(85)` |
|
|
86
|
+
| `.save(name)` | Save image | `.save("result.jpg")`
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### 💡 Lighting
|
|
91
|
+
|
|
92
|
+
| Method | Description | Example |
|
|
93
|
+
|:------|:------------|:--------|
|
|
94
|
+
| `.apply_brightness(f)` | Adjust brightness | `.apply_brightness(1.2)` |
|
|
95
|
+
| `.apply_contrast(f)` | Adjust contrast | `.apply_contrast(1.5)` |
|
|
96
|
+
| `.adjust_gamma(g)` | Correct image gamma | `.adjust_gamma(1.3)` |
|
|
97
|
+
| `.auto_enhance()` | Improve brightness, contrast and sharpness | `.auto_enhance()` |
|
|
98
|
+
| `.invert()` | Invert image colors | `.invert()` |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### 🎨 Filters
|
|
103
|
+
|
|
104
|
+
| Method | Description | Example |
|
|
105
|
+
|:------|:------------|:--------|
|
|
106
|
+
| `.apply_sepia()` | Classic sepia effect | `.apply_sepia()` |
|
|
107
|
+
| `.apply_grayscale(f)` | Convert to grayscale | `.apply_grayscale(1.0)` |
|
|
108
|
+
| `.apply_blur(r)` | Gaussian blur | `.apply_blur(5.0)` |
|
|
109
|
+
| `.apply_sharpen()` | Sharpen image | `.apply_sharpen()` |
|
|
110
|
+
| `.apply_camscanner()` | Document scanner effect | `.apply_camscanner()` |
|
|
111
|
+
| `.apply_preset(name)` | Apply a professional preset | `.apply_preset("vintage")` |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### ✨ Extras
|
|
116
|
+
|
|
117
|
+
| Method | Description | Example |
|
|
118
|
+
|:------|:------------|:--------|
|
|
119
|
+
| `.flip(dir)` | Flip image | `.flip("horizontal")` |
|
|
120
|
+
| `.add_watermark(path)` | Add watermark | `.add_watermark("logo.png")` |
|
|
121
|
+
| `.add_text(text, pos)` | Draw text | `.add_text("Hello!", (50,50))` |
|
|
122
|
+
| `.add_border(size, color)` | Add border | `.add_border(10, (0,0,0))` |
|
|
123
|
+
| `.round_corners(radius)` | Round image corners | `.round_corners(40)` |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 📊 Analysis
|
|
128
|
+
|
|
129
|
+
| Method | Description | Example |
|
|
130
|
+
|:------|:------------|:--------|
|
|
131
|
+
| `.histogram()` | Generate histogram data | `.histogram()` |
|
|
132
|
+
| `.compare()` | Display image metadata and processing summary | `.compare()` |
|
|
133
|
+
|
|
134
|
+
## 🛠️ Requirements
|
|
135
|
+
|
|
136
|
+
To use `SnapForge`, ensure you have the following installed:
|
|
137
|
+
|
|
138
|
+
* **Python:** 3.7 or higher
|
|
139
|
+
* **Dependencies:**
|
|
140
|
+
* `Pillow` (for image processing)
|
|
141
|
+
* `requests` (for automatic update checks)
|
|
142
|
+
* `packaging` (for version comparison logic)
|
|
143
|
+
|
|
144
|
+
## 🤝 Contributing
|
|
145
|
+
|
|
146
|
+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
147
|
+
|
|
148
|
+
## 🌟 More Projects
|
|
149
|
+
|
|
150
|
+
If you enjoy SnapForge, you might also like this project ,too:
|
|
151
|
+
|
|
152
|
+
### PixSlim
|
|
153
|
+
|
|
154
|
+
A Python image and ... compression library focused on reducing file size while preserving quality.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## 📜 License
|
|
158
|
+
|
|
159
|
+
Distributed under the MIT License.
|
|
160
|
+
|
|
161
|
+
## ❤️ Support
|
|
162
|
+
|
|
163
|
+
If you find SnapForge useful, your support means a lot!
|
|
164
|
+
|
|
165
|
+
You can help by:
|
|
166
|
+
|
|
167
|
+
- 📦 Installing the package and trying it in your projects
|
|
168
|
+
- 📝 Sharing feedback and suggestions
|
|
169
|
+
- 🐛 Reporting bugs and improvements
|
|
170
|
+
- 🌟 Recommending SnapForge to other Python developers
|
|
171
|
+
|
|
172
|
+
🧩 Every piece of feedback helps make SnapForge better. 🙏
|
|
173
|
+
|
|
174
|
+
## 👤 Author
|
|
175
|
+
|
|
176
|
+
### Ali.Shm
|
|
177
|
+
|
|
178
|
+
**Project Maintainer**
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# 📸 SnapForge
|
|
2
|
+
|
|
3
|
+
[](...)
|
|
4
|
+
[](...)
|
|
5
|
+
[](...)
|
|
6
|
+
[](...)
|
|
7
|
+
[](...)
|
|
8
|
+
[](...)
|
|
9
|
+
|
|
10
|
+
> **Forge your images with a single chain of commands.**
|
|
11
|
+
|
|
12
|
+
A lightweight, fast and intuitive Python library for image processing built on top of Pillow.
|
|
13
|
+
|
|
14
|
+
Perfect for resizing, filtering, enhancing and transforming images with a clean, chainable API.
|
|
15
|
+
|
|
16
|
+
## ✨ Features
|
|
17
|
+
|
|
18
|
+
- 🚀 **Fast & Lightweight**: Minimal overhead for quick image tasks.
|
|
19
|
+
|
|
20
|
+
- 🔄 **Format Conversion**: Easily switch between JPEG, PNG, BMP, and more.
|
|
21
|
+
|
|
22
|
+
- 📏 **Smart Resizing**: High-quality scaling and resizing capabilities.
|
|
23
|
+
|
|
24
|
+
- 🛠️ **Easy API**: Designed with developer experience in mind—simple commands for complex tasks.
|
|
25
|
+
|
|
26
|
+
- 🐍 **Pythonic**: Follows Python's best practices for a seamless integration.
|
|
27
|
+
|
|
28
|
+
- 🔗 **Chainable API**: Build powerful image processing pipelines with clean and readable method chaining.
|
|
29
|
+
|
|
30
|
+
- 📷 **Powered by Pillow**: Uses the trusted Pillow library for reliable image processing.
|
|
31
|
+
|
|
32
|
+
- ⚡ **Efficient Processing**: Designed for smooth and practical image manipulation workflows.
|
|
33
|
+
|
|
34
|
+
- 🧾 **MIT License**: Open-source and free to use in personal and commercial projects.
|
|
35
|
+
|
|
36
|
+
## 📦 Installation
|
|
37
|
+
|
|
38
|
+
You can install SnapForge directly from PyPI using `pip`:
|
|
39
|
+
```bash
|
|
40
|
+
pip install snapforge
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 🚀 Quick Start
|
|
44
|
+
|
|
45
|
+
Here is a quick example to get you started with SnapForge:
|
|
46
|
+
```bash
|
|
47
|
+
from snapforge import SnapForge
|
|
48
|
+
|
|
49
|
+
(
|
|
50
|
+
SnapForge("photo.jpg")
|
|
51
|
+
.resize(800, 600)
|
|
52
|
+
.apply_grayscale(1.0)
|
|
53
|
+
.add_text("SnapForge", (30, 30))
|
|
54
|
+
.optimize(85)
|
|
55
|
+
.save("result.jpg")
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
print("Image processed successfully!")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
# 📦 Available Methods
|
|
62
|
+
Here is the complete list of all available methods in SnapForge:
|
|
63
|
+
|
|
64
|
+
### ⚙️ Core
|
|
65
|
+
|
|
66
|
+
| Method | Description | Example |
|
|
67
|
+
|:------|:------------|:--------|
|
|
68
|
+
| `.convert(fmt)` | Change image format (PNG, JPG, WEBP...) | `.convert("PNG")` |
|
|
69
|
+
| `.resize(w, h)` | Change image dimensions | `.resize(800, 600)` |
|
|
70
|
+
| `.thumbnail(w, h)` | Resize while keeping aspect ratio | `.thumbnail(500, 500)` |
|
|
71
|
+
| `.fit(w, h)` | Resize and crop to exact dimensions | `.fit(1080, 1080)` |
|
|
72
|
+
| `.crop(l, t, r, b)` | Crop image | `.crop(0,0,100,100)` |
|
|
73
|
+
| `.rotate(a)` | Rotate image | `.rotate(90)` |
|
|
74
|
+
| `.optimize(q)` | Set JPEG quality | `.optimize(85)` |
|
|
75
|
+
| `.save(name)` | Save image | `.save("result.jpg")`
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 💡 Lighting
|
|
80
|
+
|
|
81
|
+
| Method | Description | Example |
|
|
82
|
+
|:------|:------------|:--------|
|
|
83
|
+
| `.apply_brightness(f)` | Adjust brightness | `.apply_brightness(1.2)` |
|
|
84
|
+
| `.apply_contrast(f)` | Adjust contrast | `.apply_contrast(1.5)` |
|
|
85
|
+
| `.adjust_gamma(g)` | Correct image gamma | `.adjust_gamma(1.3)` |
|
|
86
|
+
| `.auto_enhance()` | Improve brightness, contrast and sharpness | `.auto_enhance()` |
|
|
87
|
+
| `.invert()` | Invert image colors | `.invert()` |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### 🎨 Filters
|
|
92
|
+
|
|
93
|
+
| Method | Description | Example |
|
|
94
|
+
|:------|:------------|:--------|
|
|
95
|
+
| `.apply_sepia()` | Classic sepia effect | `.apply_sepia()` |
|
|
96
|
+
| `.apply_grayscale(f)` | Convert to grayscale | `.apply_grayscale(1.0)` |
|
|
97
|
+
| `.apply_blur(r)` | Gaussian blur | `.apply_blur(5.0)` |
|
|
98
|
+
| `.apply_sharpen()` | Sharpen image | `.apply_sharpen()` |
|
|
99
|
+
| `.apply_camscanner()` | Document scanner effect | `.apply_camscanner()` |
|
|
100
|
+
| `.apply_preset(name)` | Apply a professional preset | `.apply_preset("vintage")` |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### ✨ Extras
|
|
105
|
+
|
|
106
|
+
| Method | Description | Example |
|
|
107
|
+
|:------|:------------|:--------|
|
|
108
|
+
| `.flip(dir)` | Flip image | `.flip("horizontal")` |
|
|
109
|
+
| `.add_watermark(path)` | Add watermark | `.add_watermark("logo.png")` |
|
|
110
|
+
| `.add_text(text, pos)` | Draw text | `.add_text("Hello!", (50,50))` |
|
|
111
|
+
| `.add_border(size, color)` | Add border | `.add_border(10, (0,0,0))` |
|
|
112
|
+
| `.round_corners(radius)` | Round image corners | `.round_corners(40)` |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### 📊 Analysis
|
|
117
|
+
|
|
118
|
+
| Method | Description | Example |
|
|
119
|
+
|:------|:------------|:--------|
|
|
120
|
+
| `.histogram()` | Generate histogram data | `.histogram()` |
|
|
121
|
+
| `.compare()` | Display image metadata and processing summary | `.compare()` |
|
|
122
|
+
|
|
123
|
+
## 🛠️ Requirements
|
|
124
|
+
|
|
125
|
+
To use `SnapForge`, ensure you have the following installed:
|
|
126
|
+
|
|
127
|
+
* **Python:** 3.7 or higher
|
|
128
|
+
* **Dependencies:**
|
|
129
|
+
* `Pillow` (for image processing)
|
|
130
|
+
* `requests` (for automatic update checks)
|
|
131
|
+
* `packaging` (for version comparison logic)
|
|
132
|
+
|
|
133
|
+
## 🤝 Contributing
|
|
134
|
+
|
|
135
|
+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
136
|
+
|
|
137
|
+
## 🌟 More Projects
|
|
138
|
+
|
|
139
|
+
If you enjoy SnapForge, you might also like this project ,too:
|
|
140
|
+
|
|
141
|
+
### PixSlim
|
|
142
|
+
|
|
143
|
+
A Python image and ... compression library focused on reducing file size while preserving quality.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 📜 License
|
|
147
|
+
|
|
148
|
+
Distributed under the MIT License.
|
|
149
|
+
|
|
150
|
+
## ❤️ Support
|
|
151
|
+
|
|
152
|
+
If you find SnapForge useful, your support means a lot!
|
|
153
|
+
|
|
154
|
+
You can help by:
|
|
155
|
+
|
|
156
|
+
- 📦 Installing the package and trying it in your projects
|
|
157
|
+
- 📝 Sharing feedback and suggestions
|
|
158
|
+
- 🐛 Reporting bugs and improvements
|
|
159
|
+
- 🌟 Recommending SnapForge to other Python developers
|
|
160
|
+
|
|
161
|
+
🧩 Every piece of feedback helps make SnapForge better. 🙏
|
|
162
|
+
|
|
163
|
+
## 👤 Author
|
|
164
|
+
|
|
165
|
+
### Ali.Shm
|
|
166
|
+
|
|
167
|
+
**Project Maintainer**
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "snapforge"
|
|
7
|
-
version = "
|
|
7
|
+
version = "2.0.0"
|
|
8
8
|
description = "Powerful and fast image editor! 😎"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name="Ali.Shm"},
|
|
@@ -13,4 +13,6 @@ readme = {file = "README.md", content-type = "text/markdown"}
|
|
|
13
13
|
requires-python = ">=3.7"
|
|
14
14
|
dependencies = [
|
|
15
15
|
"Pillow>=9.0.0",
|
|
16
|
-
|
|
16
|
+
"requests>=2.25.0",
|
|
17
|
+
"packaging>=20.0",
|
|
18
|
+
]
|
|
@@ -4,6 +4,7 @@ import requests
|
|
|
4
4
|
import threading
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
from packaging import version
|
|
7
|
+
import io
|
|
7
8
|
|
|
8
9
|
class SnapForgeUpdater:
|
|
9
10
|
def __init__(self, package_name: str, current_version: str):
|
|
@@ -49,7 +50,7 @@ class SnapForgeUpdater:
|
|
|
49
50
|
thread.start()
|
|
50
51
|
|
|
51
52
|
class SnapForge:
|
|
52
|
-
__version__ = "
|
|
53
|
+
__version__ = "2.0.0"
|
|
53
54
|
|
|
54
55
|
def __init__(self, image_path: str):
|
|
55
56
|
""" 😎 Load your image and get ready for the magic! 😎 """
|
|
@@ -91,8 +92,6 @@ class SnapForge:
|
|
|
91
92
|
print(f"✨ Success: Optimization mode enabled (Quality: {quality}%)")
|
|
92
93
|
return self
|
|
93
94
|
|
|
94
|
-
# --- NEW FEATURES ADDED BELOW ---
|
|
95
|
-
|
|
96
95
|
def apply_brightness(self, factor: float):
|
|
97
96
|
""" 😎 Light it up or dim it down! 😎
|
|
98
97
|
factor: 1.0 is original, < 1.0 is darker, > 1.0 is brighter
|
|
@@ -112,27 +111,54 @@ class SnapForge:
|
|
|
112
111
|
return self
|
|
113
112
|
|
|
114
113
|
def apply_sepia(self):
|
|
115
|
-
""" 😎
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
""" 😎 Fast Sepia Filter using Matrix Transformation 😎 """
|
|
115
|
+
sepia_matrix = (
|
|
116
|
+
0.393, 0.769, 0.189, 0,
|
|
117
|
+
0.349, 0.686, 0.168, 0,
|
|
118
|
+
0.272, 0.534, 0.131, 0
|
|
119
|
+
)
|
|
120
|
+
self.image = self.image.convert("RGB"
|
|
121
|
+
).transform(self.image.size, Image.AFFINE,
|
|
122
|
+
data=None, method=Image.BICUBIC)
|
|
123
|
+
|
|
124
|
+
self.image = self.image.convert("RGB")
|
|
125
|
+
matrix = [0.393, 0.769, 0.189, 0,
|
|
126
|
+
0.349, 0.686, 0.168, 0,
|
|
127
|
+
0.272, 0.534, 0.131, 0]
|
|
128
|
+
self.image = self.image.convert("RGB", matrix)
|
|
129
|
+
from PIL import ImageMath
|
|
130
|
+
print(f"📜 Success: Fast Sepia effect applied!")
|
|
128
131
|
return self
|
|
129
132
|
|
|
133
|
+
|
|
130
134
|
def apply_blur(self, radius: float):
|
|
131
135
|
""" 😎 Make it dreamy! 😎 """
|
|
132
136
|
self.image = self.image.filter(ImageFilter.GaussianBlur(radius))
|
|
133
137
|
print(f"☁️ Success: Blur applied with radius {radius}")
|
|
134
138
|
return self
|
|
135
139
|
|
|
140
|
+
def histogram(self):
|
|
141
|
+
""" 😎 Show image histogram! 😎 """
|
|
142
|
+
histogram = self.image.histogram()
|
|
143
|
+
print("📊 Success: Histogram generated")
|
|
144
|
+
return histogram
|
|
145
|
+
|
|
146
|
+
def adjust_gamma(self, gamma: float):
|
|
147
|
+
""" 😎 Correct image gamma! 😎 """
|
|
148
|
+
|
|
149
|
+
inv_gamma = 1 / gamma
|
|
150
|
+
|
|
151
|
+
table = [
|
|
152
|
+
int(((i / 255) ** inv_gamma) * 255)
|
|
153
|
+
for i in range(256)
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
self.image = self.image.point(table * len(self.image.getbands()))
|
|
157
|
+
|
|
158
|
+
print(f"🌗 Success: Gamma corrected ({gamma})")
|
|
159
|
+
|
|
160
|
+
return self
|
|
161
|
+
|
|
136
162
|
def add_text(self, text, position=(10, 10), font_size=30, color=(255, 255, 255)):
|
|
137
163
|
""" ✍️ Write some magic on your image! ✍️ """
|
|
138
164
|
from PIL import ImageDraw, ImageFont
|
|
@@ -190,6 +216,13 @@ class SnapForge:
|
|
|
190
216
|
}
|
|
191
217
|
print(f"📊 Image Status: {info}")
|
|
192
218
|
return self
|
|
219
|
+
|
|
220
|
+
def auto_enhance(self):
|
|
221
|
+
""" 🤖 AI-like Auto Enhancement 🤖 """
|
|
222
|
+
self.apply_contrast(1.1)
|
|
223
|
+
self.apply_brightness(1.05)
|
|
224
|
+
print("✨ Success: Auto-enhancement applied!")
|
|
225
|
+
return self
|
|
193
226
|
|
|
194
227
|
def apply_preset(self, preset_name: str) -> 'SnapForge':
|
|
195
228
|
"""
|
|
@@ -323,5 +356,4 @@ class SnapForge:
|
|
|
323
356
|
"""
|
|
324
357
|
self.image = self.image.crop((left, top, right, bottom))
|
|
325
358
|
print(f"✂️ Success: Image cropped to ({left}, {top}, {right}, {bottom})")
|
|
326
|
-
return self
|
|
327
|
-
|
|
359
|
+
return self
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snapforge
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Powerful and fast image editor! 😎
|
|
5
|
+
Author: Ali.Shm
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: Pillow>=9.0.0
|
|
9
|
+
Requires-Dist: requests>=2.25.0
|
|
10
|
+
Requires-Dist: packaging>=20.0
|
|
11
|
+
|
|
12
|
+
# 📸 SnapForge
|
|
13
|
+
|
|
14
|
+
[](...)
|
|
15
|
+
[](...)
|
|
16
|
+
[](...)
|
|
17
|
+
[](...)
|
|
18
|
+
[](...)
|
|
19
|
+
[](...)
|
|
20
|
+
|
|
21
|
+
> **Forge your images with a single chain of commands.**
|
|
22
|
+
|
|
23
|
+
A lightweight, fast and intuitive Python library for image processing built on top of Pillow.
|
|
24
|
+
|
|
25
|
+
Perfect for resizing, filtering, enhancing and transforming images with a clean, chainable API.
|
|
26
|
+
|
|
27
|
+
## ✨ Features
|
|
28
|
+
|
|
29
|
+
- 🚀 **Fast & Lightweight**: Minimal overhead for quick image tasks.
|
|
30
|
+
|
|
31
|
+
- 🔄 **Format Conversion**: Easily switch between JPEG, PNG, BMP, and more.
|
|
32
|
+
|
|
33
|
+
- 📏 **Smart Resizing**: High-quality scaling and resizing capabilities.
|
|
34
|
+
|
|
35
|
+
- 🛠️ **Easy API**: Designed with developer experience in mind—simple commands for complex tasks.
|
|
36
|
+
|
|
37
|
+
- 🐍 **Pythonic**: Follows Python's best practices for a seamless integration.
|
|
38
|
+
|
|
39
|
+
- 🔗 **Chainable API**: Build powerful image processing pipelines with clean and readable method chaining.
|
|
40
|
+
|
|
41
|
+
- 📷 **Powered by Pillow**: Uses the trusted Pillow library for reliable image processing.
|
|
42
|
+
|
|
43
|
+
- ⚡ **Efficient Processing**: Designed for smooth and practical image manipulation workflows.
|
|
44
|
+
|
|
45
|
+
- 🧾 **MIT License**: Open-source and free to use in personal and commercial projects.
|
|
46
|
+
|
|
47
|
+
## 📦 Installation
|
|
48
|
+
|
|
49
|
+
You can install SnapForge directly from PyPI using `pip`:
|
|
50
|
+
```bash
|
|
51
|
+
pip install snapforge
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 🚀 Quick Start
|
|
55
|
+
|
|
56
|
+
Here is a quick example to get you started with SnapForge:
|
|
57
|
+
```bash
|
|
58
|
+
from snapforge import SnapForge
|
|
59
|
+
|
|
60
|
+
(
|
|
61
|
+
SnapForge("photo.jpg")
|
|
62
|
+
.resize(800, 600)
|
|
63
|
+
.apply_grayscale(1.0)
|
|
64
|
+
.add_text("SnapForge", (30, 30))
|
|
65
|
+
.optimize(85)
|
|
66
|
+
.save("result.jpg")
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
print("Image processed successfully!")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
# 📦 Available Methods
|
|
73
|
+
Here is the complete list of all available methods in SnapForge:
|
|
74
|
+
|
|
75
|
+
### ⚙️ Core
|
|
76
|
+
|
|
77
|
+
| Method | Description | Example |
|
|
78
|
+
|:------|:------------|:--------|
|
|
79
|
+
| `.convert(fmt)` | Change image format (PNG, JPG, WEBP...) | `.convert("PNG")` |
|
|
80
|
+
| `.resize(w, h)` | Change image dimensions | `.resize(800, 600)` |
|
|
81
|
+
| `.thumbnail(w, h)` | Resize while keeping aspect ratio | `.thumbnail(500, 500)` |
|
|
82
|
+
| `.fit(w, h)` | Resize and crop to exact dimensions | `.fit(1080, 1080)` |
|
|
83
|
+
| `.crop(l, t, r, b)` | Crop image | `.crop(0,0,100,100)` |
|
|
84
|
+
| `.rotate(a)` | Rotate image | `.rotate(90)` |
|
|
85
|
+
| `.optimize(q)` | Set JPEG quality | `.optimize(85)` |
|
|
86
|
+
| `.save(name)` | Save image | `.save("result.jpg")`
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### 💡 Lighting
|
|
91
|
+
|
|
92
|
+
| Method | Description | Example |
|
|
93
|
+
|:------|:------------|:--------|
|
|
94
|
+
| `.apply_brightness(f)` | Adjust brightness | `.apply_brightness(1.2)` |
|
|
95
|
+
| `.apply_contrast(f)` | Adjust contrast | `.apply_contrast(1.5)` |
|
|
96
|
+
| `.adjust_gamma(g)` | Correct image gamma | `.adjust_gamma(1.3)` |
|
|
97
|
+
| `.auto_enhance()` | Improve brightness, contrast and sharpness | `.auto_enhance()` |
|
|
98
|
+
| `.invert()` | Invert image colors | `.invert()` |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### 🎨 Filters
|
|
103
|
+
|
|
104
|
+
| Method | Description | Example |
|
|
105
|
+
|:------|:------------|:--------|
|
|
106
|
+
| `.apply_sepia()` | Classic sepia effect | `.apply_sepia()` |
|
|
107
|
+
| `.apply_grayscale(f)` | Convert to grayscale | `.apply_grayscale(1.0)` |
|
|
108
|
+
| `.apply_blur(r)` | Gaussian blur | `.apply_blur(5.0)` |
|
|
109
|
+
| `.apply_sharpen()` | Sharpen image | `.apply_sharpen()` |
|
|
110
|
+
| `.apply_camscanner()` | Document scanner effect | `.apply_camscanner()` |
|
|
111
|
+
| `.apply_preset(name)` | Apply a professional preset | `.apply_preset("vintage")` |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### ✨ Extras
|
|
116
|
+
|
|
117
|
+
| Method | Description | Example |
|
|
118
|
+
|:------|:------------|:--------|
|
|
119
|
+
| `.flip(dir)` | Flip image | `.flip("horizontal")` |
|
|
120
|
+
| `.add_watermark(path)` | Add watermark | `.add_watermark("logo.png")` |
|
|
121
|
+
| `.add_text(text, pos)` | Draw text | `.add_text("Hello!", (50,50))` |
|
|
122
|
+
| `.add_border(size, color)` | Add border | `.add_border(10, (0,0,0))` |
|
|
123
|
+
| `.round_corners(radius)` | Round image corners | `.round_corners(40)` |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 📊 Analysis
|
|
128
|
+
|
|
129
|
+
| Method | Description | Example |
|
|
130
|
+
|:------|:------------|:--------|
|
|
131
|
+
| `.histogram()` | Generate histogram data | `.histogram()` |
|
|
132
|
+
| `.compare()` | Display image metadata and processing summary | `.compare()` |
|
|
133
|
+
|
|
134
|
+
## 🛠️ Requirements
|
|
135
|
+
|
|
136
|
+
To use `SnapForge`, ensure you have the following installed:
|
|
137
|
+
|
|
138
|
+
* **Python:** 3.7 or higher
|
|
139
|
+
* **Dependencies:**
|
|
140
|
+
* `Pillow` (for image processing)
|
|
141
|
+
* `requests` (for automatic update checks)
|
|
142
|
+
* `packaging` (for version comparison logic)
|
|
143
|
+
|
|
144
|
+
## 🤝 Contributing
|
|
145
|
+
|
|
146
|
+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
147
|
+
|
|
148
|
+
## 🌟 More Projects
|
|
149
|
+
|
|
150
|
+
If you enjoy SnapForge, you might also like this project ,too:
|
|
151
|
+
|
|
152
|
+
### PixSlim
|
|
153
|
+
|
|
154
|
+
A Python image and ... compression library focused on reducing file size while preserving quality.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## 📜 License
|
|
158
|
+
|
|
159
|
+
Distributed under the MIT License.
|
|
160
|
+
|
|
161
|
+
## ❤️ Support
|
|
162
|
+
|
|
163
|
+
If you find SnapForge useful, your support means a lot!
|
|
164
|
+
|
|
165
|
+
You can help by:
|
|
166
|
+
|
|
167
|
+
- 📦 Installing the package and trying it in your projects
|
|
168
|
+
- 📝 Sharing feedback and suggestions
|
|
169
|
+
- 🐛 Reporting bugs and improvements
|
|
170
|
+
- 🌟 Recommending SnapForge to other Python developers
|
|
171
|
+
|
|
172
|
+
🧩 Every piece of feedback helps make SnapForge better. 🙏
|
|
173
|
+
|
|
174
|
+
## 👤 Author
|
|
175
|
+
|
|
176
|
+
### Ali.Shm
|
|
177
|
+
|
|
178
|
+
**Project Maintainer**
|
snapforge-1.3.0/PKG-INFO
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: snapforge
|
|
3
|
-
Version: 1.3.0
|
|
4
|
-
Summary: Powerful and fast image editor! 😎
|
|
5
|
-
Author: Ali.Shm
|
|
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
|
-
Here is the complete list of all available methods in SnapForge:
|
|
53
|
-
|
|
54
|
-
Category Method Description Example
|
|
55
|
-
Core .convert(fmt) Change image format (e.g., PNG, JPG) .convert("PNG")
|
|
56
|
-
.resize(w, h) Change image dimensions .resize(800, 600)
|
|
57
|
-
.thumbnail(w, h) Resize to fit within max dimensions (aspect ratio preserved) .thumbnail(500, 500)
|
|
58
|
-
.fit(w, h) Resize and crop to exact dimensions (social media style) .fit(1080, 1080)
|
|
59
|
-
.crop(l, t, r, b) Crop image to specific boundaries .crop(0, 0, 100, 100)
|
|
60
|
-
.rotate(a) Rotate image by angle .rotate(90)
|
|
61
|
-
.optimize(q) Set compression quality (1-100) .optimize(85)
|
|
62
|
-
.save(name) Save the final forged image .save("result.jpg")
|
|
63
|
-
Lighting .apply_brightness(f) Adjust brightness (factor > 1.0 is brighter) .apply_brightness(1.2)
|
|
64
|
-
.apply_contrast(f) Adjust contrast (factor > 1.0 is higher) .apply_contrast(1.5)
|
|
65
|
-
.invert() Invert image colors (negative effect) .invert()
|
|
66
|
-
Filters .apply_sepia() Apply a classic vintage sepia effect .apply_sepia()
|
|
67
|
-
.apply_grayscale(f) Convert to black & white (0.0 to 1.0) .apply_grayscale(1.0)
|
|
68
|
-
.apply_blur(r) Apply Gaussian blur with radius r .apply_blur(5.0)
|
|
69
|
-
.apply_sharpen() Enhance image sharpness/clarity .apply_sharpen()
|
|
70
|
-
.apply_camscanner() Apply document scanner effect (B&W/Threshold) .apply_camscanner()
|
|
71
|
-
.apply_preset(name) Apply professional mood (vintage, cinematic, etc.) .apply_preset("vibrant")
|
|
72
|
-
Extras .flip(dir) Flip image (horizontal or vertical) .flip("horizontal")
|
|
73
|
-
.add_watermark(p) Add a watermark image .add_watermark("logo.png")
|
|
74
|
-
.add_text(txt, pos) Add custom text to the image .add_text("Hello!", (50,50))
|
|
75
|
-
.add_border(s, col) Add a colored border around the image .add_border(10, (0,0,0))
|
|
76
|
-
.round_corners(r) Round the corners of the image (requires RGBA) .round_corners(40)
|
|
77
|
-
.compare() Show image metadata and status .compare()
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
🛠️ Requirements
|
|
81
|
-
|
|
82
|
-
Python: 3.7 or higher
|
|
83
|
-
Dependencies: Pillow
|
|
84
|
-
|
|
85
|
-
🤝 Contributing
|
|
86
|
-
|
|
87
|
-
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
88
|
-
|
|
89
|
-
📜 License
|
|
90
|
-
|
|
91
|
-
Distributed under the MIT License.
|
|
92
|
-
|
|
93
|
-
👤 Author
|
|
94
|
-
|
|
95
|
-
Ali.Shm
|
|
96
|
-
Project Maintainer
|
snapforge-1.3.0/README.md
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
Here is the complete list of all available methods in SnapForge:
|
|
44
|
-
|
|
45
|
-
Category Method Description Example
|
|
46
|
-
Core .convert(fmt) Change image format (e.g., PNG, JPG) .convert("PNG")
|
|
47
|
-
.resize(w, h) Change image dimensions .resize(800, 600)
|
|
48
|
-
.thumbnail(w, h) Resize to fit within max dimensions (aspect ratio preserved) .thumbnail(500, 500)
|
|
49
|
-
.fit(w, h) Resize and crop to exact dimensions (social media style) .fit(1080, 1080)
|
|
50
|
-
.crop(l, t, r, b) Crop image to specific boundaries .crop(0, 0, 100, 100)
|
|
51
|
-
.rotate(a) Rotate image by angle .rotate(90)
|
|
52
|
-
.optimize(q) Set compression quality (1-100) .optimize(85)
|
|
53
|
-
.save(name) Save the final forged image .save("result.jpg")
|
|
54
|
-
Lighting .apply_brightness(f) Adjust brightness (factor > 1.0 is brighter) .apply_brightness(1.2)
|
|
55
|
-
.apply_contrast(f) Adjust contrast (factor > 1.0 is higher) .apply_contrast(1.5)
|
|
56
|
-
.invert() Invert image colors (negative effect) .invert()
|
|
57
|
-
Filters .apply_sepia() Apply a classic vintage sepia effect .apply_sepia()
|
|
58
|
-
.apply_grayscale(f) Convert to black & white (0.0 to 1.0) .apply_grayscale(1.0)
|
|
59
|
-
.apply_blur(r) Apply Gaussian blur with radius r .apply_blur(5.0)
|
|
60
|
-
.apply_sharpen() Enhance image sharpness/clarity .apply_sharpen()
|
|
61
|
-
.apply_camscanner() Apply document scanner effect (B&W/Threshold) .apply_camscanner()
|
|
62
|
-
.apply_preset(name) Apply professional mood (vintage, cinematic, etc.) .apply_preset("vibrant")
|
|
63
|
-
Extras .flip(dir) Flip image (horizontal or vertical) .flip("horizontal")
|
|
64
|
-
.add_watermark(p) Add a watermark image .add_watermark("logo.png")
|
|
65
|
-
.add_text(txt, pos) Add custom text to the image .add_text("Hello!", (50,50))
|
|
66
|
-
.add_border(s, col) Add a colored border around the image .add_border(10, (0,0,0))
|
|
67
|
-
.round_corners(r) Round the corners of the image (requires RGBA) .round_corners(40)
|
|
68
|
-
.compare() Show image metadata and status .compare()
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
🛠️ Requirements
|
|
72
|
-
|
|
73
|
-
Python: 3.7 or higher
|
|
74
|
-
Dependencies: Pillow
|
|
75
|
-
|
|
76
|
-
🤝 Contributing
|
|
77
|
-
|
|
78
|
-
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
79
|
-
|
|
80
|
-
📜 License
|
|
81
|
-
|
|
82
|
-
Distributed under the MIT License.
|
|
83
|
-
|
|
84
|
-
👤 Author
|
|
85
|
-
|
|
86
|
-
Ali.Shm
|
|
87
|
-
Project Maintainer
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: snapforge
|
|
3
|
-
Version: 1.3.0
|
|
4
|
-
Summary: Powerful and fast image editor! 😎
|
|
5
|
-
Author: Ali.Shm
|
|
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
|
-
Here is the complete list of all available methods in SnapForge:
|
|
53
|
-
|
|
54
|
-
Category Method Description Example
|
|
55
|
-
Core .convert(fmt) Change image format (e.g., PNG, JPG) .convert("PNG")
|
|
56
|
-
.resize(w, h) Change image dimensions .resize(800, 600)
|
|
57
|
-
.thumbnail(w, h) Resize to fit within max dimensions (aspect ratio preserved) .thumbnail(500, 500)
|
|
58
|
-
.fit(w, h) Resize and crop to exact dimensions (social media style) .fit(1080, 1080)
|
|
59
|
-
.crop(l, t, r, b) Crop image to specific boundaries .crop(0, 0, 100, 100)
|
|
60
|
-
.rotate(a) Rotate image by angle .rotate(90)
|
|
61
|
-
.optimize(q) Set compression quality (1-100) .optimize(85)
|
|
62
|
-
.save(name) Save the final forged image .save("result.jpg")
|
|
63
|
-
Lighting .apply_brightness(f) Adjust brightness (factor > 1.0 is brighter) .apply_brightness(1.2)
|
|
64
|
-
.apply_contrast(f) Adjust contrast (factor > 1.0 is higher) .apply_contrast(1.5)
|
|
65
|
-
.invert() Invert image colors (negative effect) .invert()
|
|
66
|
-
Filters .apply_sepia() Apply a classic vintage sepia effect .apply_sepia()
|
|
67
|
-
.apply_grayscale(f) Convert to black & white (0.0 to 1.0) .apply_grayscale(1.0)
|
|
68
|
-
.apply_blur(r) Apply Gaussian blur with radius r .apply_blur(5.0)
|
|
69
|
-
.apply_sharpen() Enhance image sharpness/clarity .apply_sharpen()
|
|
70
|
-
.apply_camscanner() Apply document scanner effect (B&W/Threshold) .apply_camscanner()
|
|
71
|
-
.apply_preset(name) Apply professional mood (vintage, cinematic, etc.) .apply_preset("vibrant")
|
|
72
|
-
Extras .flip(dir) Flip image (horizontal or vertical) .flip("horizontal")
|
|
73
|
-
.add_watermark(p) Add a watermark image .add_watermark("logo.png")
|
|
74
|
-
.add_text(txt, pos) Add custom text to the image .add_text("Hello!", (50,50))
|
|
75
|
-
.add_border(s, col) Add a colored border around the image .add_border(10, (0,0,0))
|
|
76
|
-
.round_corners(r) Round the corners of the image (requires RGBA) .round_corners(40)
|
|
77
|
-
.compare() Show image metadata and status .compare()
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
🛠️ Requirements
|
|
81
|
-
|
|
82
|
-
Python: 3.7 or higher
|
|
83
|
-
Dependencies: Pillow
|
|
84
|
-
|
|
85
|
-
🤝 Contributing
|
|
86
|
-
|
|
87
|
-
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
|
|
88
|
-
|
|
89
|
-
📜 License
|
|
90
|
-
|
|
91
|
-
Distributed under the MIT License.
|
|
92
|
-
|
|
93
|
-
👤 Author
|
|
94
|
-
|
|
95
|
-
Ali.Shm
|
|
96
|
-
Project Maintainer
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Pillow>=9.0.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|