Skip to content

Instantly share code, notes, and snippets.

@yvan
Created November 6, 2017 20:22
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 yvan/01f56b3319f4c3eb12a07a62c8277e9a to your computer and use it in GitHub Desktop.
Save yvan/01f56b3319f4c3eb12a07a62c8277e9a to your computer and use it in GitHub Desktop.
a,b = shape[0]/2, shape[1]/2
n = 1024
r = 125
y,x = np.ogrid[-a:n-a, -b:n-b]
# creates a mask with True False values
# at indices
mask = x**2+y**2 <= r**2
black = [0, 0, 0]
island_world = np.zeros_like(color_world)
for i in range(shape[0]):
for j in range(shape[1]):
if mask[i][j]:
island_world[i][j] = color_world[i][j]
else:
island_world[i][j] = black
toimage(island_world).show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment