java – Android Camera setJpegQuality ignored-ThrowExceptions

Exception or error:

It seems that the setJpegQuality method of Camera.Parameters is ignored, at least on the devices I’ve tried it with (Nexus S, Galaxy S2).

Does it work for anyone else, or is this a known issue, or am I doing something wrong, or… ?

Code for setting parameters below. jpeg quality 1 is very distinctive, so it’s very easy to determine visually whether it’s working… and it isn’t! Other parameters set here (e.g. sepia) work.

    camera =;
    final Camera.Parameters parameters = camera.getParameters();
    // Let's set a SEPIA effect, just to verify these parameters are working at all!
    // I've seen this syntax too on the internet, presumably it's legacy.
    parameters.set("jpeg-quality", 1);
How to solve:

Set all attributes of the picture:

parameters.setPreviewSize(854, 480);  // (h, w)
   parameters.set("jpeg-quality", 100);
   parameters.set("orientation", "landscape");
   parameters.set("rotation", 90);

Leave a Reply

Your email address will not be published. Required fields are marked *