GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — webssh/scripts/build-product-gifs.py at main · ega-d/webssh Expand file tree/ Copy pathbuild-product-gifs.pyMore file actions 94 lines (83 loc) · 3.93 KB / Copy pathbuild-product-gifs.pyFile metadata and controls94 lines (83 loc) · 3.93 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 """Encode product tours from browser captures (requires the optional Pillow package). Run after WEBSSH_CAPTURE_ASSETS=1 product-captures.spec.js. No app data or network access is used. Each frame is a real capture; transitions only crossfade. """ import argparse import subprocess import tempfile from pathlib import Path from PIL import Image ROOT = Path(__file__).resolve().parents[1] SIZE = (1280, 720) def encode(paths, destination): stills = [] for path in paths: with Image.open(path) as image: if image.width * 9 != image.height * 16: raise ValueError(f"Capture must be 16:9: {path.name}") stills.append(image.convert('RGB').resize(SIZE, Image.Resampling.LANCZOS)) frames, durations = [], [] for index, still in enumerate(stills): frames.append(still) durations.append(2600) following = stills[(index + 1) % len(stills)] for step in range(1, 6): frames.append(Image.blend(still, following, step / 6)) durations.append(60) palette_frames = [image.quantize(colors=128) for image in frames] palette_frames[0].save( destination, save_all=True, append_images=palette_frames[1:], duration=durations, loop=0, disposal=2, optimize=False, ) print(f"{destination.name}: {len(frames)} frames, {sum(durations) / 1000:.1f}s") def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--capture-root', type=Path, default=ROOT) parser.add_argument('--video', action='store_true', help='Also encode the silent version 3 tour using ffmpeg') args = parser.parse_args() root = args.capture_root.resolve() assets = root / 'assets' frames = root / '.test-run.tmp' tours = { 'webssh-demo.gif': [assets / name for name in ( 'workspace-overview.png', 'multi-session.png', 'sftp-workspace.png', 'commandlibrary.png', 'command-set-builder.png', 'security-center.png', )], 'file-editing.gif': [ frames / 'file-editing-frames' / '01-dual-pane-overview.png', frames / 'file-editing-frames' / '03-readme-preview.png', frames / 'file-editing-frames' / '04-content-edited.png', assets / 'file-edit-review.png', frames / 'file-editing-frames' / '05-saved-preview.png', frames / 'file-editing-frames' / '06-transfer-complete.png', ], 'command-sets.gif': sorted((frames / 'command-sets-frames').glob('*.png')), } for name, sources in tours.items(): if len(sources) != 6 or any(not source.is_file() for source in sources): raise ValueError(f"Missing captures for {name}; run product captures first") for name, sources in tours.items(): encode(sources, assets / name) themes = sorted((frames / 'theme-frames').glob('*.png')) if len(themes) != 11: raise ValueError('Capture all eleven themes before encoding') encode(themes, assets / 'webssh-themes.gif') if args.video: slides = [assets / name for name in ( 'dashboard.png', 'workspace-overview.png', 'sftp-workspace.png', 'command-set-builder.png', 'security-center.png', )] with tempfile.TemporaryDirectory() as temporary: sequence = Path(temporary) for index, source in enumerate(slides): with Image.open(source) as image: image.convert('RGB').resize(SIZE, Image.Resampling.LANCZOS).save(sequence / f'{index:02d}.png') subprocess.run([ 'ffmpeg', '-y', '-loglevel', 'error', '-framerate', '1/4', '-i', str(sequence / '%02d.png'), '-t', '20', '-r', '24', '-c:v', 'libvpx-vp9', '-crf', '34', '-b:v', '0', '-pix_fmt', 'yuv420p', str(assets / 'webssh-3-tour.webm'), ], check=True) print('webssh-3-tour.webm: five slides, 20s, no audio') if __name__ == '__main__': main() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |