storeframe 0.1.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.
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ .venv/
4
+ dist/
5
+ build/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ /out/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andreas Stefl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.5
2
+ Name: storeframe
3
+ Version: 0.1.0
4
+ Summary: Frame app screenshots in drawn device bodies for the App Store and Google Play
5
+ Author: Andreas Stefl
6
+ License-Expression: MIT AND OFL-1.1
7
+ License-File: LICENSE
8
+ License-File: src/storeframe/fonts/OFL.txt
9
+ Keywords: app store,device frame,fastlane,google play,mockup,screenshots
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Multimedia :: Graphics
15
+ Classifier: Topic :: Software Development :: Build Tools
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: pillow>=10.1
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=8; extra == 'dev'
20
+ Requires-Dist: ruff>=0.6; extra == 'dev'
21
+ Description-Content-Type: text/markdown
22
+
23
+ # storeframe
24
+
25
+ Frame raw app captures for the App Store and Google Play: a gradient background,
26
+ the capture inside a **drawn** device body (no mockup PNGs), a fitted two-line
27
+ headline, and optional decorations that run across the whole gallery.
28
+
29
+ > Working name. `frameapp` is already taken on PyPI; renaming is one
30
+ > search-and-replace of `storeframe`.
31
+
32
+ ## Install
33
+
34
+ ```sh
35
+ pip install storeframe # once published
36
+ pip install -e '.[dev]' # from this checkout
37
+ ```
38
+
39
+ ## Use
40
+
41
+ ```sh
42
+ # frame a fastlane-style tree: captures/<locale>/*.png -> framed/<locale>/*.png
43
+ storeframe frame design.json --platform android --captured fastlane/screenshots --out fastlane/framed
44
+ storeframe frame design.json --platform ios --captured fastlane/screenshots --out fastlane/framed --locale en-US
45
+
46
+ # Play's 1024x500 feature graphic, from the first screen's phone capture
47
+ storeframe frame design.json --platform android --captured ... --out ... --feature-graphic
48
+
49
+ # one picture
50
+ storeframe one design.json capture.png out.png --screen 01-path --platform ios
51
+
52
+ storeframe devices # list devices, platforms, styles
53
+ ```
54
+
55
+ ```python
56
+ from PIL import Image
57
+ import storeframe
58
+
59
+ design = storeframe.Design.load("design.json")
60
+ picture = storeframe.screenshot(Image.open("phone-01-path.png"), design, "01-path",
61
+ kind="phone", device="pixel-pro", canvas_size=(1440, 2560))
62
+ ```
63
+
64
+ ## Platforms and devices
65
+
66
+ | Platform | Kind | Device | Output canvas |
67
+ |---|---|---|---|
68
+ | `android` | `phone` | `pixel-pro` | 1440×2560 (Play refuses > 2:1) |
69
+ | `android` | `tablet` | `pixel-tablet` | 1600×2560 |
70
+ | `ios` | `iphone` | `iphone-pro-max` | capture size (App Store wants the device size) |
71
+ | `ios` | `ipad` | `ipad-pro-13` | capture size |
72
+
73
+ A capture named `<kind>-<screen>.png` says its kind; otherwise (fastlane
74
+ snapshot names like `iPhone 17 Pro Max-01-path.png`) the kind is picked by
75
+ aspect ratio. The screen is the design screen whose name (or alias) the file
76
+ name ends with.
77
+
78
+ Device geometry is expressed as fractions of the *screen* width, so a device
79
+ looks the same however large it is drawn.
80
+
81
+ ## Styles
82
+
83
+ - `plain` – centred device, headline above.
84
+ - `arc` – a dashed parabola spanning the whole gallery, sun in the first picture, moon in the last.
85
+ - `tabs` – device off-centre, coloured tabs running off the left edge, a dashed line
86
+ that crosses every picture (each one picks it up where the previous one left it)
87
+ and a second line hanging off the tabs.
88
+
89
+ ## The design file
90
+
91
+ ```json
92
+ {
93
+ "style": "arc",
94
+ "font": "Nunito[wght].ttf",
95
+ "backgrounds": { "evening": ["#f2a65a", "#c9655b"] },
96
+ "chips": { "odt": "#4bb3e8" },
97
+ "screens": [
98
+ {
99
+ "name": "01-path",
100
+ "background": "evening",
101
+ "headline": { "en-US": ["See when the sun", "is where."] },
102
+ "chips": [],
103
+ "aliases": ["01-path-lite"]
104
+ }
105
+ ],
106
+ "layouts": { "phone": { "screen_top": 0.22 } },
107
+ "params": { "phone": { "arc_peak": 0.15 } },
108
+ "options": { "moon": false }
109
+ }
110
+ ```
111
+
112
+ - `font` is optional and relative to the design file; the bundled Nunito
113
+ (SIL OFL) is the default. Hindi, Japanese and Chinese headlines use a system
114
+ font (Noto on Linux, the system fonts on macOS).
115
+ - `headline` falls back from `de-AT` to `de`/`de-DE`, then to `fallback_locale` (`en-US`).
116
+ - `layouts` / `params` override a style's numbers per device kind (`phone`,
117
+ `tablet`, `iphone`, `ipad`, `feature`). See `src/storeframe/layout.py` and the
118
+ style modules for what each number means.
119
+ - Existing `frames.json` files from OpenDocument.ios/.droid and almucantar load
120
+ unchanged (`"arc": true` → `arc`, a `chips` palette → `tabs`). The
121
+ OpenDocument "lite" capture needs `"aliases": ["04-edit-lite"]` on its screen.
122
+
123
+ ## Development
124
+
125
+ ```sh
126
+ uv venv && uv pip install -e '.[dev]'
127
+ .venv/bin/pytest
128
+ ```
129
+
130
+ ## License
131
+
132
+ MIT. The bundled Nunito font is under the SIL Open Font License 1.1 (`src/storeframe/fonts/OFL.txt`).
@@ -0,0 +1,110 @@
1
+ # storeframe
2
+
3
+ Frame raw app captures for the App Store and Google Play: a gradient background,
4
+ the capture inside a **drawn** device body (no mockup PNGs), a fitted two-line
5
+ headline, and optional decorations that run across the whole gallery.
6
+
7
+ > Working name. `frameapp` is already taken on PyPI; renaming is one
8
+ > search-and-replace of `storeframe`.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ pip install storeframe # once published
14
+ pip install -e '.[dev]' # from this checkout
15
+ ```
16
+
17
+ ## Use
18
+
19
+ ```sh
20
+ # frame a fastlane-style tree: captures/<locale>/*.png -> framed/<locale>/*.png
21
+ storeframe frame design.json --platform android --captured fastlane/screenshots --out fastlane/framed
22
+ storeframe frame design.json --platform ios --captured fastlane/screenshots --out fastlane/framed --locale en-US
23
+
24
+ # Play's 1024x500 feature graphic, from the first screen's phone capture
25
+ storeframe frame design.json --platform android --captured ... --out ... --feature-graphic
26
+
27
+ # one picture
28
+ storeframe one design.json capture.png out.png --screen 01-path --platform ios
29
+
30
+ storeframe devices # list devices, platforms, styles
31
+ ```
32
+
33
+ ```python
34
+ from PIL import Image
35
+ import storeframe
36
+
37
+ design = storeframe.Design.load("design.json")
38
+ picture = storeframe.screenshot(Image.open("phone-01-path.png"), design, "01-path",
39
+ kind="phone", device="pixel-pro", canvas_size=(1440, 2560))
40
+ ```
41
+
42
+ ## Platforms and devices
43
+
44
+ | Platform | Kind | Device | Output canvas |
45
+ |---|---|---|---|
46
+ | `android` | `phone` | `pixel-pro` | 1440×2560 (Play refuses > 2:1) |
47
+ | `android` | `tablet` | `pixel-tablet` | 1600×2560 |
48
+ | `ios` | `iphone` | `iphone-pro-max` | capture size (App Store wants the device size) |
49
+ | `ios` | `ipad` | `ipad-pro-13` | capture size |
50
+
51
+ A capture named `<kind>-<screen>.png` says its kind; otherwise (fastlane
52
+ snapshot names like `iPhone 17 Pro Max-01-path.png`) the kind is picked by
53
+ aspect ratio. The screen is the design screen whose name (or alias) the file
54
+ name ends with.
55
+
56
+ Device geometry is expressed as fractions of the *screen* width, so a device
57
+ looks the same however large it is drawn.
58
+
59
+ ## Styles
60
+
61
+ - `plain` – centred device, headline above.
62
+ - `arc` – a dashed parabola spanning the whole gallery, sun in the first picture, moon in the last.
63
+ - `tabs` – device off-centre, coloured tabs running off the left edge, a dashed line
64
+ that crosses every picture (each one picks it up where the previous one left it)
65
+ and a second line hanging off the tabs.
66
+
67
+ ## The design file
68
+
69
+ ```json
70
+ {
71
+ "style": "arc",
72
+ "font": "Nunito[wght].ttf",
73
+ "backgrounds": { "evening": ["#f2a65a", "#c9655b"] },
74
+ "chips": { "odt": "#4bb3e8" },
75
+ "screens": [
76
+ {
77
+ "name": "01-path",
78
+ "background": "evening",
79
+ "headline": { "en-US": ["See when the sun", "is where."] },
80
+ "chips": [],
81
+ "aliases": ["01-path-lite"]
82
+ }
83
+ ],
84
+ "layouts": { "phone": { "screen_top": 0.22 } },
85
+ "params": { "phone": { "arc_peak": 0.15 } },
86
+ "options": { "moon": false }
87
+ }
88
+ ```
89
+
90
+ - `font` is optional and relative to the design file; the bundled Nunito
91
+ (SIL OFL) is the default. Hindi, Japanese and Chinese headlines use a system
92
+ font (Noto on Linux, the system fonts on macOS).
93
+ - `headline` falls back from `de-AT` to `de`/`de-DE`, then to `fallback_locale` (`en-US`).
94
+ - `layouts` / `params` override a style's numbers per device kind (`phone`,
95
+ `tablet`, `iphone`, `ipad`, `feature`). See `src/storeframe/layout.py` and the
96
+ style modules for what each number means.
97
+ - Existing `frames.json` files from OpenDocument.ios/.droid and almucantar load
98
+ unchanged (`"arc": true` → `arc`, a `chips` palette → `tabs`). The
99
+ OpenDocument "lite" capture needs `"aliases": ["04-edit-lite"]` on its screen.
100
+
101
+ ## Development
102
+
103
+ ```sh
104
+ uv venv && uv pip install -e '.[dev]'
105
+ .venv/bin/pytest
106
+ ```
107
+
108
+ ## License
109
+
110
+ MIT. The bundled Nunito font is under the SIL Open Font License 1.1 (`src/storeframe/fonts/OFL.txt`).
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "storeframe"
7
+ dynamic = ["version"]
8
+ description = "Frame app screenshots in drawn device bodies for the App Store and Google Play"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ authors = [{ name = "Andreas Stefl" }]
12
+ # the code is MIT; the bundled Nunito font is SIL OFL 1.1
13
+ license = "MIT AND OFL-1.1"
14
+ license-files = ["LICENSE", "src/storeframe/fonts/OFL.txt"]
15
+ keywords = ["screenshots", "app store", "google play", "fastlane", "device frame", "mockup"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Programming Language :: Python :: 3",
21
+ "Topic :: Multimedia :: Graphics",
22
+ "Topic :: Software Development :: Build Tools",
23
+ ]
24
+ dependencies = ["Pillow>=10.1"]
25
+
26
+ [project.optional-dependencies]
27
+ dev = ["pytest>=8", "ruff>=0.6"]
28
+
29
+ [project.scripts]
30
+ storeframe = "storeframe.cli:main"
31
+
32
+ [tool.hatch.version]
33
+ path = "src/storeframe/__init__.py"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/storeframe"]
37
+
38
+ [tool.hatch.build.targets.sdist]
39
+ include = ["src", "tests", "README.md", "LICENSE", "pyproject.toml"]
40
+
41
+ [tool.pytest.ini_options]
42
+ testpaths = ["tests"]
43
+
44
+ [tool.ruff]
45
+ line-length = 110
46
+ target-version = "py310"
@@ -0,0 +1,24 @@
1
+ """Frame app screenshots in drawn device bodies for the App Store and Google Play."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __version__ = "0.1.0"
6
+
7
+ from .batch import Report, frame_directory
8
+ from .design import Design, Screen
9
+ from .devices import DEVICES, Device
10
+ from .layout import Layout
11
+ from .render import feature_graphic, screenshot
12
+
13
+ __all__ = [
14
+ "DEVICES",
15
+ "Design",
16
+ "Device",
17
+ "Layout",
18
+ "Report",
19
+ "Screen",
20
+ "__version__",
21
+ "feature_graphic",
22
+ "frame_directory",
23
+ "screenshot",
24
+ ]
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ sys.exit(main())
@@ -0,0 +1,87 @@
1
+ """Frame a directory of captures laid out the fastlane way: ``<dir>/<locale>/*.png``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import shutil
6
+ from collections.abc import Callable, Iterable
7
+ from dataclasses import dataclass, field
8
+ from pathlib import Path
9
+
10
+ from PIL import Image
11
+
12
+ from . import platforms, render
13
+ from .design import Design
14
+
15
+
16
+ @dataclass
17
+ class Report:
18
+ written: list[Path] = field(default_factory=list)
19
+ skipped: list[tuple[Path, str]] = field(default_factory=list)
20
+ missing_locales: list[str] = field(default_factory=list)
21
+
22
+
23
+ def frame_directory(
24
+ design: Design,
25
+ platform: str,
26
+ captured: str | Path,
27
+ out: str | Path,
28
+ *,
29
+ locales: Iterable[str] | None = None,
30
+ feature_graphic: bool = False,
31
+ clean: bool = True,
32
+ progress: Callable[[Path], None] | None = None,
33
+ ) -> Report:
34
+ """Frame every capture under ``captured/<locale>/`` into ``out/<locale>/``.
35
+
36
+ Each locale's output folder is emptied first (``clean``), so a renamed screen
37
+ does not leave a stale picture behind for the upload to find. Files that match
38
+ no screen of the design are skipped and reported.
39
+ """
40
+ captured, out = Path(captured), Path(out)
41
+ platforms.get(platform)
42
+ report = Report()
43
+
44
+ if locales is None:
45
+ locales = sorted(p.name for p in captured.iterdir() if p.is_dir()) if captured.is_dir() else []
46
+
47
+ for locale in locales:
48
+ folder = captured / locale
49
+ if not folder.is_dir():
50
+ report.missing_locales.append(locale)
51
+ continue
52
+ target = out / locale
53
+ if clean:
54
+ shutil.rmtree(target, ignore_errors=True)
55
+ target.mkdir(parents=True, exist_ok=True)
56
+
57
+ feature_source: Path | None = None
58
+ for path in sorted(folder.glob("*.png")):
59
+ screen = design.match(path.stem)
60
+ if screen is None:
61
+ report.skipped.append((path, "matches no screen of the design"))
62
+ continue
63
+ with Image.open(path) as shot:
64
+ shot = shot.convert("RGB")
65
+ where = platforms.detect(platform, path.stem, shot.size)
66
+ picture = render.screenshot(shot, design, screen, kind=where.kind, device=where.device,
67
+ locale=locale, canvas_size=where.canvas)
68
+ destination = target / path.name
69
+ picture.save(destination, optimize=True)
70
+ report.written.append(destination)
71
+ if progress:
72
+ progress(destination)
73
+ if (feature_graphic and screen is design.screens[0] and screen.name in path.stem
74
+ and where.kind == next(iter(platforms.get(platform)))):
75
+ feature_source = path
76
+
77
+ if feature_graphic and feature_source is not None:
78
+ with Image.open(feature_source) as shot:
79
+ picture = render.feature_graphic(shot.convert("RGB"), design, design.screens[0],
80
+ locale=locale)
81
+ destination = target / f"{platforms.FEATURE_GRAPHIC_NAME}.png"
82
+ picture.save(destination, optimize=True)
83
+ report.written.append(destination)
84
+ if progress:
85
+ progress(destination)
86
+
87
+ return report
@@ -0,0 +1,108 @@
1
+ """Command line: ``storeframe frame``, ``storeframe one``, ``storeframe devices``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ from . import __version__, devices, platforms, render, styles
10
+ from .batch import frame_directory
11
+ from .design import Design
12
+ from .text import MissingFont
13
+
14
+
15
+ def _frame(args: argparse.Namespace) -> int:
16
+ design = Design.load(args.design)
17
+ report = frame_directory(
18
+ design, args.platform, args.captured, args.out,
19
+ locales=args.locale, feature_graphic=args.feature_graphic, clean=not args.keep,
20
+ progress=(lambda path: print(path)) if args.verbose else None,
21
+ )
22
+ for locale in report.missing_locales:
23
+ print(f"{locale}: no captures in {Path(args.captured) / locale}", file=sys.stderr)
24
+ for path, why in report.skipped:
25
+ print(f"skipped {path}: {why}", file=sys.stderr)
26
+ print(f"framed {len(report.written)} pictures into {args.out}")
27
+ return 0 if report.written else 1
28
+
29
+
30
+ def _one(args: argparse.Namespace) -> int:
31
+ from PIL import Image
32
+
33
+ design = Design.load(args.design)
34
+ with Image.open(args.capture) as shot:
35
+ shot = shot.convert("RGB")
36
+ if args.feature_graphic:
37
+ picture = render.feature_graphic(shot, design, args.screen, locale=args.locale,
38
+ device=args.device or "pixel-pro")
39
+ else:
40
+ where = platforms.detect(args.platform, Path(args.capture).stem, shot.size)
41
+ if args.kind:
42
+ where = platforms.get(args.platform).get(args.kind) or platforms.Target(
43
+ args.kind, args.device or where.device, where.canvas)
44
+ canvas = tuple(args.canvas) if args.canvas else where.canvas
45
+ picture = render.screenshot(shot, design, args.screen, kind=where.kind,
46
+ device=args.device or where.device, locale=args.locale,
47
+ canvas_size=canvas)
48
+ picture.save(args.output, optimize=True)
49
+ print(args.output)
50
+ return 0
51
+
52
+
53
+ def _devices(args: argparse.Namespace) -> int:
54
+ for device in devices.DEVICES.values():
55
+ print(f"{device.name:16} {device.title}")
56
+ print()
57
+ for name, targets in platforms.PLATFORMS.items():
58
+ for target in targets.values():
59
+ canvas = "x".join(map(str, target.canvas)) if target.canvas else "capture size"
60
+ print(f"{name:8} {target.kind:8} {target.device:16} {canvas}")
61
+ print()
62
+ print("styles:", ", ".join(styles.STYLES))
63
+ return 0
64
+
65
+
66
+ def main(argv: list[str] | None = None) -> int:
67
+ parser = argparse.ArgumentParser(prog="storeframe", description="Frame app screenshots for the stores.")
68
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
69
+ commands = parser.add_subparsers(dest="command", required=True)
70
+
71
+ frame = commands.add_parser("frame", help="frame a fastlane-style directory of captures")
72
+ frame.add_argument("design", type=Path, help="the design JSON")
73
+ frame.add_argument("--platform", required=True, choices=sorted(platforms.PLATFORMS))
74
+ frame.add_argument("--captured", required=True, type=Path, help="captures, one folder per locale")
75
+ frame.add_argument("--out", required=True, type=Path, help="framed output, one folder per locale")
76
+ frame.add_argument("--locale", action="append", help="only this locale (repeatable)")
77
+ frame.add_argument("--feature-graphic", action="store_true",
78
+ help="also draw Play's feature graphic from the first screen's phone capture")
79
+ frame.add_argument("--keep", action="store_true", help="don't empty the output locale folders first")
80
+ frame.add_argument("-v", "--verbose", action="store_true")
81
+ frame.set_defaults(run=_frame)
82
+
83
+ one = commands.add_parser("one", help="frame a single capture")
84
+ one.add_argument("design", type=Path)
85
+ one.add_argument("capture", type=Path)
86
+ one.add_argument("output", type=Path)
87
+ one.add_argument("--screen", required=True, help="screen name in the design")
88
+ one.add_argument("--platform", default="android", choices=sorted(platforms.PLATFORMS))
89
+ one.add_argument("--kind", help="layout kind (default: detected from file name / aspect)")
90
+ one.add_argument("--device", choices=sorted(devices.DEVICES), help="device body (default: platform's)")
91
+ one.add_argument("--canvas", type=int, nargs=2, metavar=("W", "H"), help="output size")
92
+ one.add_argument("--locale")
93
+ one.add_argument("--feature-graphic", action="store_true")
94
+ one.set_defaults(run=_one)
95
+
96
+ listing = commands.add_parser("devices", help="list devices, platforms and styles")
97
+ listing.set_defaults(run=_devices)
98
+
99
+ args = parser.parse_args(argv)
100
+ try:
101
+ return args.run(args)
102
+ except (MissingFont, ValueError, KeyError, FileNotFoundError) as error:
103
+ print(f"storeframe: {error}", file=sys.stderr)
104
+ return 2
105
+
106
+
107
+ if __name__ == "__main__":
108
+ sys.exit(main())