0

I am developing a live wallpaper, in which basically I am rotating around 80 frames (jpg images) - the image size is around 80KB each (800 x 1200 dimension) - total images folder size is around 6 MB.

The images loop fairly smoothly, but as soon as I scale the images (I am doing this to show images well in smaller screens) - the FPS goes for toss - any idea on how to scale the image effectively ?

I thought of two things initially - but it's not working well for me:

  1. I thought of putting all the scaled images in ArrayList of Bitmap, but it's giving a VM Budget error (tried to do bitmap.recycle() too - but it's giving another error like, trying to use recycle image). Any thought on this would be highly appreciated.
  2. I though of putting scaled images in SD card - but again, don't know why but FPS is getting affected - otherwise this can be the best way where I can detect the size of the phone and can download the images over internet and put it in SD card. But, as I said even this didn't work well.

If anyone can help with either of these approaches, or can point to a better way - that should be awesome.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Tejas J
  • 51
  • 2
  • 12

1 Answers1

0

First of all try to sample down the image then scale it . this will reduce your memory size. Secondly store this image and use that image there after. you can find sampling and scaling of imager over here. Let me know if you need more help.

Community
  • 1
  • 1
Ravi Bhojani
  • 1,032
  • 1
  • 13
  • 24
  • I have already done scaling and sampling - but those things take time - and FPS is affected when I do any of these operations. – Tejas J Aug 29 '12 at 12:09
  • You must calling every time which might be causing the issue. You should scale it when user changes the orientation. – Ravi Bhojani Aug 29 '12 at 14:57
  • my basic image is 1280 x 800 - so if I want to load my lwp in 480 x 800 resolution mobile, I have to scale the image – Tejas J Aug 30 '12 at 11:28
  • You have to first sampling down the image. That will reduce it's memory then scale it as per required. – Ravi Bhojani Aug 31 '12 at 04:25
  • sampling doesnt work always - and only power of 2 sampling works good in my case, so sampling wont help over here - and again the issue is, even sampling is time consuming, if I do it everytime. – Tejas J Aug 31 '12 at 14:55