Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Developer
mb1
Posts: 320
Registered: ‎05-26-2009
My Device: Not Specified

scaleImage32 quality is not good - options other than scaleInto

Hi,

 

I am trying ot scale images  depending on the screen resolution. However the Bitmap quality using scaleImage32 is noticeably bad.

I am unable to use scaleInto since we need to support OS versions prior to 5.0.

 

Is there a way to get better quality scaled images on OS versions prior to 5.0?

 

Thanks,

 

--MB

Developer
peter_strange
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: scaleImage32 quality is not good - options other than scaleInto

You could try the ImageManipulator Library that you find here:

http://supportforums.blackberry.com/t5/Java-Development/Rotate-and-scale-bitmaps/ta-p/492524

 

I think it does its scaling using drawTexturedPath() which might be better.

Developer
pfiffi78
Posts: 242
Registered: ‎01-29-2009
My Device: Not Specified

Re: scaleImage32 quality is not good - options other than scaleInto

I tried the ImageManipulator on a 350 x 350 pixel PNG graphics (not a photo) to scale it to 50 x 50 pixels and the performance is really bad. In fact the ImageManipulator.scale(Bitmap, scale) never returned. 

 

I made sure that I specify scale as Fixed32 value.

 

 

Developer
Developer
mb1
Posts: 320
Registered: ‎05-26-2009
My Device: Not Specified

Re: scaleImage32 quality is not good - options other than scaleInto

I tried ImageManipulator as well. But the quality is similar to scaleImage32. The ImageManipulator library just uses placeholder for different interpolation algorithms (BI_LINEAR, LANCZOS etc.) but does not implement them.

 

I implemented bi-linear interpolation and the results are acceptable. I will stil have to test if the performance is acceptable on actual devices.

Developer
pfiffi78
Posts: 242
Registered: ‎01-29-2009
My Device: Not Specified

Re: scaleImage32 quality is not good - options other than scaleInto

Use this, I found it yesterday:

 

http://supportforums.blackberry.com/t5/Java-Development/Resizing-Transparent-Bitmaps/ta-p/703239

 

It works a treat. Now I can scale my images on the device without loosing quality or transparency. RIM should take this algorithm and implemented in OS 7 with native GPU support to make it really fast too.

 

The speed of the function now is ok. Just don't load to many images at app start up.

Developer
Developer
mb1
Posts: 320
Registered: ‎05-26-2009
My Device: Not Specified

Re: scaleImage32 quality is not good - options other than scaleInto

It will not work on devices running OS lower than 5.0 since it uses Bitmap.scaleInto.

 

 

Developer
pfiffi78
Posts: 242
Registered: ‎01-29-2009
My Device: Not Specified

Re: scaleImage32 quality is not good - options other than scaleInto

Maybe, but hand on your heart: all the devices that still run 4.6 and can't be upgraded to 5.0 have such low res screens, you don't need good image quality there ;-)

 

But seriously: I have stopped bothering with 4.6. 5.0 is now the minimum for my apps. 7.0 is ante portas. So it's time to cut legacy and move on.