Nominate our 2022 Qt Champions!

Change the colors palette for images ?

  • Hi,

    I am working a a lttle gui application but when i use a png as an icon for a pushbutton or for a label the colors are wrong (for example blue is purple, black is blue...) on my target (only of the image, the colors of the forms are good).

    is there a way to chnage the palette used by qt when reading, displaying a picture ?

  • Moderators

    If the image is paletted 8-bit format then you can set individual colos using setColor.
    There's no built-in function to color-correct an image. You would have to use a third party library (like OpenCV) for that or do it manually.

    One thing to check though are the ICC profiles embedded in the png files. Removing them might solve the issue. Image editors usually have this option when exporting images in png format.

  • It seems that the blue is blue, green is becoming red and red is becoming green. When comparing the normal image and what is displayed.

    I tryied using a jpeg, nothing appears (i even put the imageformat folder in /Trolltech.../plugins and in the folders where the application is).

    A black and white image is not problem but a all the png are weird, which is strange because when testing the same kind of program on an ubuntu pc the colors are good.

  • Ok this seems to work.
    For anyone curious to make it works :
    I downloaded gimp, open my image then image>mode>indexed.
    Saving the image as indexed and not with rgb channels seems to do the trick.

  • Banned

    This post is deleted!

Log in to reply