ipythonblocks.ImageGrid
¶To learn more about ipythonblocks
visit the homepage at https://github.com/jiffyclub/ipythonblocks.
ImageGrid
is a class that imitates image manipulation libraries like PIL.
Key differences from BlockGrid
are:
Pixel
objects, which have .x
(column) and .y
(row) attributesfrom ipythonblocks import ImageGrid
grid = ImageGrid(10, 10, fill=(124, 124, 124), block_size=15)
grid
for pixel in grid:
if pixel.x < 5:
pixel.green = 255
elif pixel.x > 5 and pixel.y >= 5:
pixel.blue = 255
grid
grid[:3, :3] = (255, 124, 124)
grid
grid[::4, ::4] = (0, 0, 0)
grid
grid[6, :] = (255, 0, 255)
grid
grid[:, 6] = (255, 255, 0)
grid