Skip to content

Instantly share code, notes, and snippets.

@jessstringham
Last active April 8, 2018 18:51
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 jessstringham/1fab85175358650242c57d99817ed413 to your computer and use it in GitHub Desktop.
Save jessstringham/1fab85175358650242c57d99817ed413 to your computer and use it in GitHub Desktop.
image = mpimg.imread(IMAGE_LOCATION)
# pasta the first image
h, w, c = image.shape
image = image.reshape(h // 2, 2, w, c)
image = image.transpose(1, 0, 2, 3)
image = np.hstack(image)
# rotate the image
image = image.transpose(1, 0, 2)
# pasta the double image
h, w, c = image.shape
image = image.reshape(h // 2, 2, w, c)
# move the 2 image into the first dimension, and rotate the four images
image = image.transpose(1, 2, 0, 3)
image = np.hstack(image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment