Python RGB Convertor

A handy python script I made to convert 8-bit colour codes to openGL/Renderman style RGB. Someone else might find use for it, designed to run from terminal. I have the following alias in my bashrc:

alias rgbConv='~/./'

This then lets me run it from terminal easily. You just need to put it in your home directory and change the name if necessary.

Feel free to copy it from below

#Using code from
#to handle the clipboard
import pygtk
import gtk
import sys
print "RGB Converted!"
r = float(sys.argv[1])
g = float(sys.argv[2])
b = float(sys.argv[3])
    r = 255
    g = 255
    b = 255
rgb = str('%.2f' % (r/255) +'f'+ ','
        + '%.2f' % (g/255) +'f'+ ','
        + '%.2f' % (b/255) +'f')
clipboard = gtk.clipboard_get()
text = clipboard.wait_for_text()

Leave a Reply

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