grissiom
6th April 2008, 11:22
Hello,
I'm a newbie. How to set the color table of a image? My script is:
#coding = utf-8
# file_name = test2.py
from PyQt4 import QtCore, QtGui
im = QtGui.QImage(10, 10, QtGui.QImage.Format_Indexed8)
im.setColorTable([QtCore.Qt.black, QtCore.Qt.white, QtCore.Qt.red])
im.setPixel(1, 2, 0)
im.setPixel(2, 1, 1)
im.setPixel(0, 2, 2)
im.save('/home/grissiom/im.png')
but the image is totally black. How could I fix it? Thanks in advance ;)
I'm a newbie. How to set the color table of a image? My script is:
#coding = utf-8
# file_name = test2.py
from PyQt4 import QtCore, QtGui
im = QtGui.QImage(10, 10, QtGui.QImage.Format_Indexed8)
im.setColorTable([QtCore.Qt.black, QtCore.Qt.white, QtCore.Qt.red])
im.setPixel(1, 2, 0)
im.setPixel(2, 1, 1)
im.setPixel(0, 2, 2)
im.save('/home/grissiom/im.png')
but the image is totally black. How could I fix it? Thanks in advance ;)