picamera icon indicating copy to clipboard operation
picamera copied to clipboard

JPEG "quality" argument ignored?

Open qgeissmann opened this issue 3 years ago • 1 comments

Hello, I am using the pi camera HQ, on archlinux arm, and picamera==1.13 and attempting to set JPEG quality during capture. Adapting the documentation recipe:

import time
import picamera
with picamera.PiCamera() as camera:
    camera.resolution = (1024, 768)
    camera.start_preview()
    # Camera warm-up time
    time.sleep(2)
    camera.capture('foo.jpg', quality=90)

I notice my images are the same approximate size regardless of what value I set for quality. Using ImageMagick's identify confirms Quality is actually 100, not 90 as set:

identify -verbose /run/media/quentin/SPI_DRIVE/foo.jpg  | grep Quality
  Quality: 100

The documentation says:

Certain file formats accept additional options which can be specified as keyword arguments. Currently, only the 'jpeg' encoder accepts additional options, which are: quality - Defines the quality of the JPEG encoder as an integer ranging from 1 to 100. Defaults to 85. Please note that JPEG quality is not a percentage and definitions of quality vary widely.

It seems that the default is actually 100 for this camera/setup? Does anyone else have the same pproblem or a solution?

qgeissmann avatar Sep 27 '21 23:09 qgeissmann

As in the docs:

definitions of quality vary widely

Picamera's quality parameter does not match with ImageMagick's. Such is life.

6by9 avatar Sep 28 '21 07:09 6by9