How do I convert QImage RGB888 to QImage ARGB?



  • such that alpha is always 255 or 1 i.e. all pixels are visible.



  • qt's doc:

    bq. An image's format can be retrieved using the format() function. Use the convertToFormat() functions to convert an image into another format

    the default alpha channel value for each pixel should be 255 ... anyway you can use pixel manipulation to alter the alpha value:

    [object Object] = qRgb(image.pixel(1,1)); // read the pixel color and fill alpha=255
    image.setPixel(1, 1, value);@

    bq. QRgb qRgb ( int r, int g, int b )
    Returns the ARGB quadruplet (255, r, g, b).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.