[Qt-interest] QImageWriter says JPEG supported, but won't write JPEG Files
Josiah Bryan
jbryan at productiveconcepts.com
Fri Oct 30 13:55:49 CET 2009
Rainer Wiesenfarth wrote:
> From: Josiah Bryan
>> I can't seem to get QImageWriter to write out JPEG files, even though
>> the supportedImageFormats() list gives jpeg/jpg as a
>> supported format!
>> (Qt "4.7.0" and 4.5.2 both exhibit this problem)
>>
>> I don't get any errors from the QImageWriter API, but the
>> message on the
>> console is:
>>
>> QJpegHandler: unable to write image of format 7
>> [...]
>
> I took a look at QImage's documentation and it tells me that "format 7" is
> QImage::Format_RGB16 (16bit/pixel, 5-6-5). Probably you have to convert your
> image to a "more standard" format like QImage::Format_RGB32, using
> QImage::convertToFormat().
Wow, reading the docs! Novel idea! :-) I just assumed that the "Format
7" meant the jpeg format itself. Ooops. Thanks, Rainer! Passing the
image through convertToFormat(QImage::Format_RGB32) worked like a charm
- lovely jpeg images now written to any stream my little heart desires.
Thanks!
More information about the Qt-interest-old
mailing list