Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Gamma correction for display
Forum Updated to NodeBB v4.3 + New Features

Gamma correction for display

Scheduled Pinned Locked Moved Unsolved General and Desktop
pyside2image
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • krzysieklfcK Offline
    krzysieklfcK Offline
    krzysieklfc
    wrote on last edited by
    #1

    I have a simple problem regarding final image look in QLabel. The image obviously lacks any gamma correction when displayed in QLabel and appears too dark. I wonder how to solve this. Shouldn't Qt somehow handle the color correction when I'm 'telling it' to view the image? I'm surely missing some crucial point.

    I'm creating QImage object from raw data, then I convert it to QPixmap and feed it to QLabel.

    		buffer = bytearray()
    		for y in xrange(height):
    			for x in xrange(width):
    				pixel = jpg_storage.GetPixel(x,y)
    				buffer.append(pixel.GetR()/256)
    				buffer.append(pixel.GetG()/256)
    				buffer.append(pixel.GetB()/256)
    
    		img = QtGui.QImage(buffer, width, height, QtGui.QImage.Format_RGB888)
    		label.setPixmap(QtGui.QPixmap.fromImage(img))
    
    raven-worxR 1 Reply Last reply
    0
    • krzysieklfcK krzysieklfc

      I have a simple problem regarding final image look in QLabel. The image obviously lacks any gamma correction when displayed in QLabel and appears too dark. I wonder how to solve this. Shouldn't Qt somehow handle the color correction when I'm 'telling it' to view the image? I'm surely missing some crucial point.

      I'm creating QImage object from raw data, then I convert it to QPixmap and feed it to QLabel.

      		buffer = bytearray()
      		for y in xrange(height):
      			for x in xrange(width):
      				pixel = jpg_storage.GetPixel(x,y)
      				buffer.append(pixel.GetR()/256)
      				buffer.append(pixel.GetG()/256)
      				buffer.append(pixel.GetB()/256)
      
      		img = QtGui.QImage(buffer, width, height, QtGui.QImage.Format_RGB888)
      		label.setPixmap(QtGui.QPixmap.fromImage(img))
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @krzysieklfc said in Gamma correction for display:

      Shouldn't Qt somehow handle the color correction when I'm 'telling it' to view the image?

      no! why should it?

      I don't quite understand why you are dividing by 256?
      Also whats the returning type of GetR()/GetG()/GetB()?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved