Hi All,

I have some issues with color using pyqtgraph.
I have a basic code for displaying a RGBA image.
I am expecting to have a color image but instead I have a graylevel image
Do you see an obvious explanation to this behavior in this code ?

from pyqtgraph.Qt import QtCore, QtGui

import pyqtgraph as pg

import cv2

 

pg.setConfigOptions(imageAxisOrder='row-major')

 

app = QtGui.QApplication([])

## Create window with GraphicsView widget

win = pg.GraphicsLayoutWidget()

win.show()  ## show widget alone in its own window

win.setWindowTitle('pyqtgraph example: ImageItem')

view = win.addViewBox()

view.invertY(True)

 

## lock the aspect ratio so pixels are always square

view.setAspectLocked(True)

 

## Create image item

l_img_item = pg.ImageItem(border='w')

view.addItem(l_img_item)

l_img_item.setCompositionMode(QtGui.QPainter.CompositionMode_Plus)

# l_img_item.setZValue(10)

# l_img_item.setOpacity(0.5)

 

l_image = cv2.imread('_test.png')

l_image = cv2.cvtColor(l_image, cv2.COLOR_RGBA2RGB)

 

## Set initial view bounds

view.setRange(QtCore.QRectF(0, 0, 375, 400))

 

# timer = QtCore.QTimer()

# timer.timeout.connect(self._update)

# timer.start(50)

l_img_item.setImage(l_image, autoLevels=False)

l_img_item.setCompositionMode(QtGui.QPainter.CompositionMode_Plus)

app.exec_()


Thanks for your help


-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/28bcd3c1-bf68-495a-be2d-65e0021f4cd1n%40googlegroups.com.

Reply via email to