×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    20

    Image Conversion in 3rd Ed

    Hi Guys,

    I am trying to convert the non bmp images of large size (apprx, 3 - 4 MB) using CMdaImageFileToBitmapUtility API. The file is opened successfully but once I try to convert it gives me -6 (KErrArgument)error. I am not using the TFrameInfo::iOverallSizeInPixels while creating the bitmap instead I am explicitly passing the image size, just to save the memory. Here what my code looks like.
    =========================================================================
    iBitmapUtility = CMdaImageFileToBitmapUtility::NewL(*this);
    TSize iIconSize;

    void A::OpenImageFile(const TDesC& aFilePath, TSize aSize)
    {
    iIconSize = aSize;
    iBitmapUtility->OpenL(aFilePath);
    }

    void A::MiuoOpenComplete(TInt aError)
    {
    if(aError == KErrNone)
    {
    if(iBitmap)
    {
    delete iBitmap;
    iBitmap = NULL;
    }
    iBitmap = new(ELeave)CFbsBitmap();

    TInt err = iBitmap->Create(iIconSize, EColor16M);

    if(err == KErrNone)
    {
    TRAPD(err1, iBitmapUtility->ConvertL(iBitmap));
    }
    else
    {
    if(iBitmap)
    {
    delete iBitmap;
    iBitmap = NULL;
    }
    //inform the observer about the error
    iObserver->AsyncImageLoadingFailed();
    }
    }
    else
    {
    //inform the observer about the error
    iObserver->AsyncImageLoadingFailed();
    }
    }

    void A::MiuoConvertComplete(TInt aError)
    {
    //Here it returns the aError as -6 (KErrArgument)
    iBitmapUtility->Close();
    }


    =========================================================================

    Anyone could please tell me why I am getting the -6 error on conversion of large non bmp images.

    Thanks in advance,
    sanjay

  2. #2
    Super Contributor
    Join Date
    May 2003
    Location
    Vancouver, Canada
    Posts
    985

    Re: Image Conversion in 3rd Ed

    Note that CMdaImageFileToBitmapUtility has been deprecated since S60 2nd. Here is the explanation from the SDK Help:

    This class has been deprecated in 7.0s, it's functionality is now part of the Image Converter Library. For more information see CImageDecoder.
    As mentioned there, it is recommended to use CImageDecoder.
    Antony Pranata
    http://www.antonypranata.com/
    http://www.s60tips.com/

  3. #3
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Image Conversion in 3rd Ed

    CImageDecoder is very easy to use and you should infact switch to it:
    this is the sample code - u need active objects !

    TBuf8<256> mimeType;
    CImageDecoder::GetMimeTypeFileL(aFs, aSourceFilename, mimeType);
    iImageDecoder = CImageDecoder::FileNewL(aFs, aSourceFilename, mimeType);
    const TFrameInfo& frameInfo = iImageDecoder->FrameInfo(aFrameNumber);
    aDestination.Create(frameInfo.iOverallSizeInPixels, frameInfo.iFrameDisplayMode);
    iImageDecoder->Convert(&iStatus, aDestination, aFrameNumber);
    SetActive();

    hope this helps !
    Amit Kankani
    Nokia Developer Champion

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    20

    Re: Image Conversion in 3rd Ed

    Hi amitkankani& antonypr,

    As you guys said now I am using the CImageDecoder class to convert the large non bmp images, but here also I am getting the -6 error if I use the image size which is passed explicitly instead of from TFrameInfo class. If I use the size from TFrameInfo class it just works fine, but I don't want to keep the images in memory which are just too big (3 - 4 MB).

    And also I have to convert many non bmp images and then have to display them in the grid.

    So do you guys have any better solution for this?

    Thanks again,
    sanjay

  5. #5
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: Image Conversion in 3rd Ed

    What about using CBitmapScaler class?

  6. #6
    Registered User
    Join Date
    Apr 2005
    Posts
    20

    Re: Image Conversion in 3rd Ed

    Hey Lichtens,

    I have used the CBitmapScaler and works quite good. Now I am just getting USER 47 panic while moving back/previous in grid. So gotta resolve this panic.

    Thanks a lot,
    sanjay

  7. #7
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Germany, Stuttgart
    Posts
    241

    Re: Image Conversion in 3rd Ed

    This is what panic referenz says to USER 47:

    This panic is raised by the Alloc(), AllocL() or AllocLC() member functions of RHeap. It is caused by trying to allocate a cell from a heap, specifying an unsigned size value which is greater than or equal to the value of KMaxTInt/2. The constant KMaxTInt is defined in e32std.h.

  8. #8
    Registered User
    Join Date
    Apr 2005
    Posts
    20

    Re: Image Conversion in 3rd Ed

    Yep Lichtens, I saw in SDK help, now just gotta go through the code and gotta find it our where it is creating an issue.

Similar Threads

  1. Problem with S60 3rd FP1 device! Image "randomly" not TRANSPARENT
    By sandro1972 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 12
    Last Post: 2008-05-19, 16:36
  2. Image Conversion
    By ckt in forum Symbian
    Replies: 5
    Last Post: 2007-02-07, 12:50
  3. Conversion of Image Using CMdaImageFileToBitmapUtility
    By indianstud2k2 in forum Symbian Media (Closed)
    Replies: 6
    Last Post: 2006-11-10, 12:40
  4. Can I get snapshot image from camera in Nokia S30 3rd Ed.
    By salopge in forum Mobile Java General
    Replies: 0
    Last Post: 2006-03-03, 08:50
  5. saving jpeg image on grid list
    By flicker82 in forum Symbian
    Replies: 0
    Last Post: 2005-01-21, 04:22

Posting Permissions

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