×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Cool CImageTransform and KErrNotFound (-1) when calling SetupL

    I have the following code which is used to scale the image down to the desired resolution. I am using CImageTransform class to achieve that.

    EXPORT_C HBufC8* TransformImageL(const TDesC& aSrcFile, const TSize& aNewSize)
    {
    if( !aSrcFile.Length() ||
    !aNewSize.iWidth || !aNewSize.iHeight ||
    !IsFilePresent(aSrcFile) )
    User::Leave(KErrArgument);

    HBufC8* pData=NULL;

    RFs fileSession;
    User::LeaveIfError(fileSession.Connect());
    CleanupClosePushL( fileSession);
    TParse fileSpec;
    fileSpec.Set(aSrcFile,NULL,NULL);
    User::LeaveIfError(fileSession.SetSessionPath(fileSpec.Path()));

    CImageTransform* pImgTransformer = CImageTransform::NewL(fileSession);
    CleanupStack::PushL(pImgTransformer);
    //pImgTransformer->SetSourceImageTypeL(KJPGImageDataUid);

    pImgTransformer->SetSourceFilenameL(aSrcFile);
    pImgTransformer->SetDestDataL(pData);
    pImgTransformer->SetDestSizeInPixelsL(aNewSize);
    pImgTransformer->SetPreserveImageData(EFalse);
    pImgTransformer->SetupL();

    CActiveListener* pListener = CActiveListener::NewLC();
    pListener->InitializeActiveListener();

    pImgTransformer->Transform(pListener->iStatus);
    CActiveScheduler::Start();
    //We are blocked here untill the operation finishes.
    User::LeaveIfError(pListener->iStatus.Int());

    //Cleanup
    CleanupStack::PopAndDestroy(3);
    return pData;
    }

    The code works fine when the image is located on drive C. When I try to convert an image on external card (drive E) then the call to SetupL() function throws KerrNotFound (No suitable plug-in was found) error. Any idea what I am doing wrong? Thanks.

    PS. Small update. The images stored on MMC card were made with internal camera (Nokia E51). The default resolution was set to 1600x1200. When I set it to 640x480 then no exception was thrown by SetupL() function. Is CImageTransform sensitive to file size or resolution?
    Last edited by palringosymbian; 2009-04-14 at 13:51.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: CImageTransform and KErrNotFound (-1) when calling SetupL

    what is the string you are using for aSrcFile ?

  3. #3
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Re: CImageTransform and KErrNotFound (-1) when calling SetupL

    Quote Originally Posted by symbianyucca View Post
    what is the string you are using for aSrcFile ?
    Hi - the file name returned by MGFetch::RunL function in the following form E:\\Images\\filename.jpg. I do not mess with the image path.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: CImageTransform and KErrNotFound (-1) when calling SetupL

    hmmm, you could actually use CImageDecoder as well, it can scale down images with ratios of 1:2, 1:4 and 1:8 :http://www.symbian.com/developer/tec...ageDecode.html

    Have to say that I have never used CImageTransform, thus if you have noticed that is depends on the scale, you could try if it works with the same ratios as the CImageDecoder does.

  5. #5
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Re: CImageTransform and KErrNotFound (-1) when calling SetupL

    Hi - Thanks for the reply. I think I'll have ditch CImageTransform class and go back to CImageDecoder as you suggested. CImageTransform is very vague and does not work all the time. I tried setting various resolutions (resizing 1600x1200 image to 800x600 but now Transform throws up error -1) but with no luck. Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×