Skip to main content

A package for manipulating images using Objective-C frameworks

Project description

macimg

A Python package for manipulating images using Objective-C frameworks.

Examples

Example 1: Applying Image Filters

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: Images produced by applying several filters sequentially

Example 2: Applying Distortions

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: Images produced by applying several distortions sequentially

Example 3: Applying Transformations

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: Images produced by applying multiple transformations sequentially

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macimg-0.0.2.tar.gz (16.4 kB view hashes)

Uploaded Source

Built Distribution

macimg-0.0.2-py3-none-any.whl (17.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page