Need Big Friggin' Images?22 Feb 2015
I found myself in need of some big friggin’ images the other day. After scouring the web for a while and coming up with paltry-sized images (ONLY hundreds of megabytes), I decided to just create some myself. I whipped up a quick Python script – imggen.py – that uses the Pillow image library to generate square images where each pixel is a random color. It’s certainly no remarkable coding achievement, but the output is pretty pretty.
The images also got really big and took a long time to generate as the size increased. Running the script with size 2000 pixels generated a 13.9 MB image in 23 seconds; 16000 pixels, 22 minutes, 875 MB; 34000 pixels, 107 minutes, 3.95 GB! Yes, I know plenty about time and space complexity for algorithms; just let me enjoy this moment as my computer struggles to generate these images!
I toyed around the script to generate images in different styles. Below is a composition of four variations of imggen.py. Clockwise from top left: the original script that generates a random color for every pixel, a rows version that picks a random color and uses that for the entire row, a grayscale version that generates a random grayscale color for every pixel, and a columns version that is similar to the rows version, but for columns instead.
Wow! Such beauty! Much pixels! Check out imggen.py and you can be a (computer) artist too!