PNG screendump has R/B channels swapped
Qemu 7.2, aarch64 system emulation on both aarch64 or x86_64 hosts.
With qemu 7.2.0 a screenshot taken via the QMP screendump
command is correct when output as a PPM, but when I write a PNG the red and blue channels are swapped.
First, the file contains a redundant alpha channel, so the PNG could be written as PNG_COLOR_TYPE_RGB
instead of PNG_COLOR_TYPE_RGB_ALPHA
.
Second, the pixel data needs to be in network byte order. I note that the PPM export code uses a PIXMAN_BE_r8g8b8
pixman buffer for the rows, whereas the PNG code uses PIXMAN_a8r8g8b8
. As we don't need the alpha channel anymore then using PIXMAN_BE_r8g8b8
should resolve the issue.
Edited by Ross Burton