Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Gamma correction for display

    General and Desktop
    pyside2 image
    2
    2
    758
    Loading More Posts
    • 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.
    • krzysieklfc
      krzysieklfc last edited by

      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-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @krzysieklfc last edited by

        @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 Reply Quote 0
        • First post
          Last post