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,
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,
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.
Thanks ,
i am using
EPOCSTACKSIZE 0x5000 // 20k
EPOCHEAPSIZE 0x400 0x800000
is this ok?
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
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.
Valid pointer.. Always forgotting that. Likely will not remember that in next time either.
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.
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;
have you checked what are the values for the other variables ?
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.