# import smilPython
import smilPython as sp
# functions using matplotlib to display images on jupyter notebooks
from smilPlot import *
import numpy as np
# Create an image
dim = 512
im = sp.Image(dim, dim)
print("")
smilPlot([im], title = ["Black square of side eq 512"])
#im1.show()
# Create a numpy array containing the real image pixels
imArr = im.getNumArray()
# Display the dimensions of the created array
print("Array dims:", imArr.shape)
Array dims: (512, 512)
# Do something with the array...
imArr[:] = 0
radius, cx, cy = dim // 3, dim // 2, dim // 2
for i in range(0, radius):
for j in range(0, radius):
if i**2 + j**2 <= radius**2:
imArr[cx - i, cy - j] = 255
imArr[cx - i, cy + j] = 255
imArr[cx + i, cy - j] = 255
imArr[cx + i, cy + j] = 255
# Show the modified image
smilPlot([im])