[email protected]
[Top] [All Lists]

Re: [Qt-interest] QImageWriter says JPEG supported, but won't write JPEG

Subject: Re: [Qt-interest] QImageWriter says JPEG supported, but won't write JPEG Files
From: Josiah Bryan
Date: Fri, 30 Oct 2009 08:55:49 -0400

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. 

Qt-interest mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>