A Python script to generate a random, fuzzy image

I am creating a speedtest tool that is more reflective of reality for our customers.

To do this, I need to create a series of unique images that are approximately 1.5-2MB in size, as that is the average size of our HDS fragments.

Here is the Python script to generate a single image:

x = 300
y = 200

import png
import numpy
l = []
for i in range(0, y):
    l.append(random.randint(0,255,x * 3).tolist())

(png.from_array(l, "RGB")).save('image.png')

After this, tweak and repeat.

Here is what an individual image looks like:
Random fuzzy image created with Python

Leave a Reply

Your email address will not be published. Required fields are marked *