How to save transparency file to JPEG file without Qt, making transparent color black? I know that JPEG does not support alpha, and black is probably just the default value โ0โ for alpha, but black is a terrible default color.
It seems like it should be a simple operation, but all the masks and alpha functions that I tried are ignored when saving in JPEG format.
For instance:
image->load("someFile.png"); // Has transparent background or alpha channel image->save("somefile.jpg", "JPG"); // Transparent color is black
I tried to fill the image with white before saving in JPEG format, converting the image to ARGB32 (with an 8-bit alpha channel) before saving and even trying ridiculously slow things like:
QImage image2 = image1->convertToFormat(QImage::Format_ARGB32); image2.setAlphaChannel(image1->alphaChannel()); image2.save(fileURI, "JPG", this->jpgQuality;
source share