QImage QRGB 64 bit pixel
-
Hello,
I am trying to convert my pngs from QImage::Format_RGB888 to QImage::Format_RGBA64. Although I can create the image as the RGBA64 format just fine, I am not sure how to manipulate the color channels and pixels? Right now I use the pixel() function which will return a qrgb type which truncates the qrgb64 type values. for example
QRgb rgbPixel = loadImage.pixel(i,j);
How can I convert this into a Qrgb64 type values and get each of the individual channels? Thank you!
-
Hi,
What kind of manipulation do you have in mind ?
-
@csing said in QImage QRGB 64 bit pixel:
How can I convert this into a Qrgb64 type values and get each of the individual channels? Thank you!
Use QImage::scanLine() and cast to QRgba64
-
Then why change the format of the image in that case ?
-
@Christian-Ehrlicher Hi, I am not sure if I am doing it correctly but it is still returning the range of the blue values are still all under 256 when I am debugging it. Here is what I wrote to test the method. Please let me know if you see something I am wrong. Thanks!
for(int i = 0; i < loadImage.height(); i++) { pixel64 = (QRgba64 *)loadImage.scanLine(i); blue = qBlue(*pixel64); }
@SGaist The end goal I am trying to reach is to be able to produce a higher-bit pngs rather than a 8-bit png and from my understanding is that the Format_RGB888 and using pixel() will crop off some of the bits.
-
What data type is your 'blue' variable of? Are you sure your image has really the format QImage::Format_RGBA64?
-
@Christian-Ehrlicher Thank you for pointing out the scanline method. I have figured it out. I should be using pixel64.blue() instead of qBlue() which will return a 8 bit value instead. Thank you for your help!