MCPcopy Create free account
hub / github.com/ActiveState/code / create_image

Function create_image

recipes/Python/577674_Bitmap_Maker/recipe-577674.py:19–25  ·  view source on GitHub ↗
(array, width, counter=[1])

Source from the content-addressed store, hash-verified

17 break
18
19def create_image(array, width, counter=[1]):
20 image = BitMap(width, len(array) // width)
21 for index, pixel in enumerate(array):
22 image.setPenColor(PALETTE[pixel])
23 image.plotPoint(*reversed(divmod(index, width)))
24 image.saveFile(str(counter[0]) + '.bmp')
25 counter[0] += 1
26
27################################################################################
28

Callers 1

mainFunction · 0.85

Calls 7

setPenColorMethod · 0.95
plotPointMethod · 0.95
saveFileMethod · 0.95
BitMapClass · 0.85
strFunction · 0.85
enumerateFunction · 0.50
reversedFunction · 0.50

Tested by

no test coverage detected