daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     def showImage(self,pixmap):
  2.         self.scene = QtWidgets.QGraphicsScene()
  3.         self.scene.addPixmap(pixmap)
  4.         self.graphicsView_2.setScene(self.scene)
  5.         self.graphicsView_2.fitInView(self.scene.itemsBoundingRect())
  6.  
  7.     def grayscale(self):
  8.         image = self.imageName
  9.         buffer = QtCore.QBuffer()
  10.         buffer.open(QtCore.QBuffer.ReadWrite)
  11.         image.save(buffer, "JPG")
  12.         pil_im = Image.open(io.BytesIO(buffer.data()))
  13.         im = pil_im.convert('RGB')
  14.         matrix = (0.2, 0.5, 0.3, 0.0, 0.2, 0.5, 0.3, 0.0, 0.2, 0.5, 0.3, 0.0)
  15.         result = im.convert('RGB',matrix)
  16.         self.showImage(self.pil2pixmap(result))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top