trim the bound of white, then convert the first and last rows and columns to text format and then filter out all white pixels, and keep only one return value (unless you want all non-white values along the edges?)
In unix this would be:
convert Z1UPu.gif -trim +repage Z1UPu_trim.gif
convert Z1UPu_trim.gif -gravity north -crop x1+0+0 txt:- | tail -n +2 | grep -m 1 -v "white"
81,0: (255,102, 0) #FF6600 rgb(255,102,0)
convert Z1UPu_trim.gif -gravity east -crop 1x+0+0 txt:- | tail -n +2 | grep -m 1 -v "white"
0,56: ( 0, 0,255) #0000FF blue
convert Z1UPu_trim.gif -gravity south -crop x1+0+0 txt:- | tail -n +2 | grep -m 1 -v "white"
83,0: (128,128,128) #808080 fractal
convert Z1UPu_trim.gif -gravity west -crop 1x+0+0 txt:- | tail -n +2 | grep -m 1 -v "white"
0,53: ( 0,255, 0) #00FF00 lime
If on Windows, then you need to review
http://www.imagemagick.org/Usage/windows/ or get one of the Windows users to help deal with the unix, tail and grep and pipes