File: random_image.py

package info (click to toggle)
mapnik 4.2.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,592 kB
  • sloc: cpp: 163,859; python: 1,332; sh: 690; xml: 161; makefile: 123; perl: 28; lisp: 13
file content (15 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import mapnik
import random

im = mapnik.Image(256,256)

for x in range(im.width()):
    for y in range(im.height()):
        r = int(random.random() * 255)
        g = random.random() * 255
        b = random.random() * 255
        a = random.random()
        color = mapnik.Color('rgba(%i,%i,%i,%f)' % (r,g,b,a))
        im.set_pixel(x,y,color)

im.save('./benchmark/data/multicolor.png')