#9 set jpeg quality for the camera module

open
nobody
None
5
2008-01-07
2008-01-07
Anonymous
No

This patch adds a new function to the camera module that allows setting the jpeg quality.

This is helpful if jpeg images are taken using the camera.
The default quality in pyS60 is 50 which is not terribly good.

Please feel free to merge this in the main source tree if you see the patch appropriate.

Best Regards,

sami [dot] sallinen (at) bitcraft {dot} fi

Discussion

  • Nobody/Anonymous

    diff for src/ext/camera/camera.py

     
  • Nobody/Anonymous

    Logged In: NO

    I messed up submitting the patch, and only got the 1st diff into the patch.
    Here are the other missing diffs:

    #cameramodule.cpp

    276,284c276,282
    < {
    < int quality = self->camera->GetJPEGQuality(); // keep the quality level over the sick camera reinit
    < delete self->camera;
    < self->camera = NULL;
    < TRAPD(error, self->camera = CMisoPhotoTaker::NewL(position));
    < if (error != KErrNone){
    < return SPyErr_SetFromSymbianOSErr(error);
    < }
    < self->camera->SetJPEGQuality(quality);
    ---
    > {
    > delete self->camera;
    > self->camera = NULL;
    > TRAPD(error, self->camera = CMisoPhotoTaker::NewL(position));
    > if (error != KErrNone){
    > return SPyErr_SetFromSymbianOSErr(error);
    > }
    407,421d404
    <
    < extern "C" PyObject *
    < set_jpeg_quality(CAM_object* self, PyObject *args)
    < {
    < TInt quality;
    <
    < if (!PyArg_ParseTuple(args, "i", &quality))
    < return NULL;
    <
    < TSize size(0, 0);
    < int qual = self->camera->SetJPEGQuality(quality);
    < return Py_BuildValue("i", qual);
    < }
    <
    <
    526d508
    < {"set_jpeg_quality", (PyCFunction)set_jpeg_quality, METH_VARARGS, NULL},

    # cameramodule.h

    88,89d87
    < int SetJPEGQuality(int quality);
    < int GetJPEGQuality() {return iJPEGQuality;}
    133d130
    < TInt iJPEGQuality;

    # takephoto.cpp

    91d90
    < iJPEGQuality = 50;
    241,249c240
    < iCamera->Reserve();
    < }
    <
    < int CMisoPhotoTaker::SetJPEGQuality(int quality)
    < {
    < if ((quality > 0) && (quality <= 100)) {
    < iJPEGQuality = quality;
    < }
    < return iJPEGQuality;
    ---
    > iCamera->Reserve();
    315,316d305
    <
    < iCamera->SetJpegQuality(iJPEGQuality);

     

Log in to post a comment.