https://github.com/skaplanofficial/macimg
A Python package for manipulating images using Objective-C frameworks.
https://github.com/skaplanofficial/macimg
image image-manipulation mac macos objective-c
Last synced: 4 months ago
JSON representation
A Python package for manipulating images using Objective-C frameworks.
- Host: GitHub
- URL: https://github.com/skaplanofficial/macimg
- Owner: SKaplanOfficial
- License: mit
- Created: 2022-12-23T06:47:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-25T03:41:21.000Z (over 1 year ago)
- Last Synced: 2024-05-01T15:42:59.522Z (about 1 year ago)
- Topics: image, image-manipulation, mac, macos, objective-c
- Language: Python
- Homepage:
- Size: 18.3 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# macimg
A Python package for manipulating images using Objective-C frameworks. Only works on macOS as it requires the Objective-C runtime.# Examples
## Example 1: Applying Image Filters
```python
from macimg import Image
from macimg.filters import (
Bloom,
Comic,
Crystallize,
Edges,
Invert,
Sepia,
Vignette
)# Load an image
img = Image("assets/Iceland1.jpg")
img.show_in_preview()# Apply a single filter
Vignette(intensity=10).apply_to(img)
img.show_in_preview()# Apply multiple filters
filters = [Comic(), Edges(), Invert(), Sepia(), Bloom(), Crystallize(crystal_size=50)]
for index, filter in enumerate(filters):
filter.apply_to(img)
img.show_in_preview()
```The code above produces the following sequence of images:
## Example 2: Applying Distortions
```python
from macimg import Image
from macimg.distortions import (
Bump,
CircleSplash,
Hole,
LightTunnel,
Pinch,
TorusLens,
Vortex,
)# Load image
img = Image("assets/Iceland2.jpg")
img.show_in_preview()# Apply multiple distortions
distortions = [Bump(radius=500, curvature=1), Vortex(radius=750, angle=1000.0), TorusLens(radius=1000, width=250), Hole(), Pinch(intensity=1), CircleSplash(), LightTunnel()]
for index, distortion in enumerate(distortions):
distortion.apply_to(img)
img.show_in_preview()
```The code above produces the following sequence of images:
## Example 3: Applying Transformations
```python
from macimg import Image
from macimg.transforms import (
Flip,
Rotate,
)# Load image
img = Image("assets/Iceland3.jpg")
img.show_in_preview()# Apply multiple transformations
transforms = [Flip("horizontal"), Flip("vertical"), Rotate(degrees=30)]
for index, transform in enumerate(transforms):
transform.apply_to(img)
img.show_in_preview()
```The code above produces the following sequence of images:
