[libcamera-devel] [PATCH] qcam: saveImageAs: Set image quality explicitly

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Mar 19 13:32:38 CET 2020


Hi Laurent,

On 18/03/2020 15:41, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Wed, Mar 18, 2020 at 03:13:36PM +0000, Kieran Bingham wrote:
>> The QImageWriter defines a method to set the output image quality.
>> Explicitly set it to 95 to override any defaults.
> 
> You could add, although it's a Qt implementation detail, that by default
> the JPEG image handler uses a quality of 75, which isn't considered high
> enough ?


Indeed, some element of 'ringing' has been observed in the output
images, so I have increased the quality level.

Thank you for determining the default setting, I hadn't identified what
the QT5 default was. I assumed I could get Qt to tell me, but the
.quality() method returns -1 for me :-(


I can update the commit message to:

"
The QImageWriter defaults to an image quality value of 75 which can lead
to perceivable visual artefacts.

Improve the quality of the output by explicitly setting the image
quality to 95.
"


>> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
>> ---
>>  src/qcam/main_window.cpp | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
>> index ae1760dfd647..1869fdfc8679 100644
>> --- a/src/qcam/main_window.cpp
>> +++ b/src/qcam/main_window.cpp
>> @@ -360,6 +360,7 @@ void MainWindow::saveImageAs()
>>  		return;
>>  
>>  	QImageWriter writer(filename);
>> +	writer.setQuality(95);
>>  	writer.write(image);
>>  }
>>  
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list