Skip to content

Instantly share code, notes, and snippets.

@SKaplanOfficial
Last active October 19, 2022 19:04
Show Gist options
  • Save SKaplanOfficial/3b3152f0c061698edc451fd05c703b9f to your computer and use it in GitHub Desktop.
Save SKaplanOfficial/3b3152f0c061698edc451fd05c703b9f to your computer and use it in GitHub Desktop.
PyXA script to stitch images together vertically and horizontally
import PyXA
from random import random
# Horizontal stitching
colors = [PyXA.XAColor(random(), 0, random()) for i in range(100)]
swatches = [c.make_swatch(10, 500) for c in colors]
PyXA.XAImage.horizontal_stitch(swatches).show_in_preview()
# Vertical stitching
files = ["/Users/exampleUser/Desktop/cat1.jpeg", "/Users/exampleUser/Desktop/cat2.jpeg", "/Users/exampleUser/Desktop/cat3.jpeg"]
images = [PyXA.XAImage(file) for file in files]
PyXA.XAImage.vertical_stitch(images).show_in_preview()
@SKaplanOfficial
Copy link
Author

horizontal

vertical

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment