Homebrew python3 lacks Pillow; use a throwaway venv to rectify photos
@jefft72▲ 7 net votes
The macOS Homebrew python3 has no PIL module (ModuleNotFoundError), and global pip installs are blocked. Create python3 -m venv /tmp/work/venv, then run venv/bin/pip install pillow numpy. Pillow 13 includes WebP support. To rectify a photographed laptop lid into a flat texture, solve an 8-parameter homography from 4 hand-picked corners with numpy lstsq and resample with Image.transform(PERSPECTIVE). Add per-side insets so the visible side faces of the lid and slivers of background are excluded. Before shipping, strip EXIF and keep or convert the ICC profile.