×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    209

    Lightbulb I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Scale

    I am getting error KErrNoMemory=(-4); when scaling image(size 3111*2343) using CBitmapScaler->Scale(&iStatus, aBitmap, aDestinationSize, aMaintainAspectRatio);

    please help me how to solve it.

    Regards,

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

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    You are running out of memory. So first you could try increasing the default heap of your App (be defining it in mmp file with EPOCHEAPSIZE line), and if that does not help, then its the device RAM that is limiting factor.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    209

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    Thanks ,

    i am using

    EPOCSTACKSIZE 0x5000 // 20k
    EPOCHEAPSIZE 0x400 0x800000

    is this ok?

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

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    3111*2343 * 4 = 29'156'292, which is 0x1BCE3C4, so you should could try EPOCHEAPSIZE 0x400 0x2000000 instead. Then again, you could also try my Y-Tasks:Trace for checking the memory consumption

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    According to my memories, bitmaps are allocated in the heap of FBS (Font and Bitmap Server - that is why they are called CFbsBitmap). And FBS uses all available memory in the device. Working with the high-res images of a Nokia N8 or especially of a Nokia 808 PureView is not necessarily trivial. A thing you can try is CBitmapScaler::UseLowMemoryAlgorithm - its existence suggests that in the default case CBitmapScaler allocates a new bitmap for the target, and that is running out of memory. However scaling downwards (I assume that is what you are trying to do) is possible with in-place algorithms, without allocating additional memory.

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

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    Valid pointer.. Always forgotting that. Likely will not remember that in next time either.

  7. #7
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    Where did you get the bitmap and what do you actually want to do with it? Is it the only bitmap that you want to scale, or can they be even bigger than this?

    If you want to just draw a scaled image or part of it to the screen (or another small bitmap), you don't necessarily need CBitmapScaler - you can use CGraphicsContext:rawBitmap(const TRect &, const CFbsBitmap *, const TRect &) with the original bitmap. Also note, that CBitmapDecoder can decode to smaller sizes of (with/2, height/2), (width/4, height/4) and so on - so if the scaled size you want is a lot less than original, maybe you could decode the original image to one quarter of the real size, for example, to avoid memory issues.

  8. #8
    Registered User
    Join Date
    Feb 2008
    Posts
    209

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    Hi Thanks , code is working fine on device

    MCameraObserver::ImageReady(CFbsBitmap* aBitmap, HBufC8* aData, TInt aError) , in this callback the aBitmap is coming NULL;


    please tell me y is it coming NUll;

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

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    have you checked what are the values for the other variables ?

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: I am getting error KErrNoMemory=(-4); when scaling image using CBitmapScaler->Sca

    Capturing with the highest resolutions are usually supported via capturing into compressed format (like jpeg/exif). And such data comes in the "HBufC8* aData".
    I am not convinced that this question has much to do with the original topic, so later it may end up in its own thread.

Similar Threads

  1. How to scale an image in M3G?
    By MobileVisuals2 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2012-10-25, 18:46
  2. Replies: 1
    Last Post: 2009-05-24, 03:21
  3. error=4 when try to scale the image
    By sandy_zeng in forum Symbian
    Replies: 3
    Last Post: 2007-10-28, 14:27
  4. Compliation error with CbitmapScaler
    By bballbeng in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-09-14, 09:52
  5. Replies: 1
    Last Post: 2005-10-24, 09:57

Posting Permissions

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