Skip to main content

Core library for applying device frames to screenshots.

Project description

device-frames-core

Core library for applying device frames to screenshots.

todo: ci/cd for pypi

Install

pip install device-frames-core

Quick Start

from pathlib import Path

from device_frames_core import apply_frame, list_devices

# List all iOS device variations
devices = list_devices(category="ios")
print(f"Found {len(devices)} iOS device variations")

apply_frame(
    screenshot_path=Path("input.png"),
    device="16-pro-max",
    variation="black-titanium",
    output_path=Path("output/framed.png"),
    category="ios",
)

API

  • list_devices(category=None, device=None) returns a list of available devices and variations, optionally filtered.
  • apply_frame(...) applies a frame using bundled assets and writes an output image.
  • find_template(device, variation, category=None) returns the template data as a dict.
  • get_frame_image(device, variation, category=None) returns the frame image as a PIL Image.
  • get_mask_image(device, variation, category=None) returns the mask image as a PIL Image.

Notes

  • Device frames and masks are fetched from the remote repository at runtime.
  • The package depends on Pillow.
  • Device and variation names use lowercase kebab-case (e.g., "16-pro-max", "black-titanium").

Usage in Your API/CLI

Install:

pip install device-frames-core

Example usage:

from pathlib import Path
from device_frames_core import apply_frame, list_devices

# List devices
all_devices = list_devices()

# Apply a frame
apply_frame(
    screenshot_path=Path("input.png"),
    device="16-pro-max",
    variation="black-titanium",
    output_path=Path("output/framed.png"),
    category="ios",
)

Tip: For local development in your API/CLI repos, install in editable mode:

pip install -e /path/to/device-frames-core

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

device_frames_core-0.1.3.tar.gz (41.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

device_frames_core-0.1.3-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file device_frames_core-0.1.3.tar.gz.

File metadata

  • Download URL: device_frames_core-0.1.3.tar.gz
  • Upload date:
  • Size: 41.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for device_frames_core-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b8c7f470190bc284a2d8a16b11a25d2ca2af4f01d7e8f3170ba6db2a13d5786e
MD5 a4bedc6a4cc012eaff9e77a46e5d62e7
BLAKE2b-256 2b8882c1528520c7252c99c4cc8b0a9ae0b9ab985c990e435fafe29f24a53a9c

See more details on using hashes here.

File details

Details for the file device_frames_core-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for device_frames_core-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 12d84d5a13c99b1004303caa9d23df1aea281f6b7029ecd43ef371e96b1574f1
MD5 0f3c754f75aedb4f073adff47c969afd
BLAKE2b-256 49ac29600807a5e29cd62b48a4e820cb362b8950085c427f56882cea5876de3e

See more details on using hashes here.

Supported by

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