Skip to content

Instantly share code, notes, and snippets.

@omz
Created July 19, 2015 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omz/25c41724d02accf995ff to your computer and use it in GitHub Desktop.
Save omz/25c41724d02accf995ff to your computer and use it in GitHub Desktop.
Mask Example.py
# Minimal example for ui.Image.clip_to_mask
# Note: Due to the changed image names, this requires Pythonista 1.6 (beta), but it could work in 1.5bwith different image names.
import ui
with ui.ImageContext(256, 256) as ctx:
mask_img = ui.Image.named('iow:beaker_256')
img = ui.Image.named('test:Peppers')
mask_img.clip_to_mask()
img.draw()
ctx.get_image().show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment