I believe in binary Zen. You're either at one with everything, or at zero with everything.

Generate Background Tiles With ImageMagick

Date/Time Permalink: 06/18/07 10:53:54 am
Category: Graphics Tutorials

generated tile

generated tile

generated tile

generated tile

generated tile

generated tile

I was puttering around with ImageMagick and wrote a short script which, when run, generates a gray-scale background tile. It is capable of a wide range of patterns, with only a few random numbers thrown at parameters. Thusly:

#!/bin/bash

RANDVAL="rand()*"$(($RANDOM % 512 + 1))

convert -size 256x256 xc: -fx $RANDVAL \
  -write mpr:rand -virtual-pixel tile \
  -blur 0x$(($RANDOM % 10)) \
  -edge $(($RANDOM % 12)) \
  -shade $(($RANDOM % 180))x$(($RANDOM % 180)) \
  -fx G -normalize randbg.jpg

exit 0

The only glitch seems to be that sometimes it complains of "convert: Zero sigma not permitted `rand'" I have no idea what that's supposed to mean, but it produces an image anyway!

Count this as a lazy hack.

Follow me on Twitter for an update every time this blog gets a post.
Stumble it Reddit this share on Facebook

suddenly the moon