User:Psychonaut/palette bitmap.sh

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
#!/bin/bash
# (requires Image Magick)
#
# Purpose: Generates a bitmap image of a uniform RGB palette
#
# Note: this is full of magic numbers, but should be easy to adapt to
#       any uniform RGB palette you need

echo 'P3 8 8 3' >ega.ppm
for r in {0..3}
do
  for g in {0..3}
  do
    for b in {0..3}
    do
      echo $r $g $b >>ega.ppm
    done
  done
done
convert ega.ppm ega.png