Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
06-25-2009 09:50 PM
Can any one tell me how to resize a bitmap without creating encoded image from it? When I create encoded image from bitmap and try to resize it, the hour glass displayed all the times. I want to get rid of that. Please advice.
06-26-2009 02:04 AM
I asked the same question in the following thread:
Unfortunately there is no other way to resize a bitmap without creating an encoded image (as of 4.7). In my case, the performance was not so bad. How big is your bitmap? Do you specify the scale parameters correctly (see the thread for an example)?
I ran this in Bold. Which device are you using? Is this a bitmap that is part of the project (static image) or it is something that you receive at run time over the network? If you provide more information I can try to give more useful suggestions.
06-26-2009 02:27 AM - edited 06-26-2009 03:08 AM
public static Bitmap resizeBitmap(Bitmap image, int width, int height)
int imageWidth = image.getWidth();
int imageHeight = image.getHeight();
// Need an array (for RGB, with the size of original image)
int rgb = new int[imageWidth * imageHeight];
// Get the RGB array of image into "rgb"
image.getARGB(rgb, 0, imageWidth, 0, 0, imageWidth, imageHeight);
// Call to our function and obtain rgb2
int rgb2 = rescaleArray(rgb, imageWidth, imageHeight, width, height);
// Create an image with that RGB array
Bitmap temp2 = new Bitmap(width, height);
temp2.setARGB(rgb2, 0, width, 0, 0, width, height);
private static int rescaleArray(int ini, int x, int y, int x2, int y2)
int out = new int[x2*y2];
for (int yy = 0; yy < y2; yy++)
int dy = yy * y / y2;
for (int xx = 0; xx < x2; xx++)
int dx = xx * x / x2;
out[(x2 * yy) + xx] = ini[(x * dy) + dx];
06-26-2009 02:52 AM
Well, I should correct myself. When I said there is no other way, I meant there is no other built-in way. If you would like to process an argb array yourself, then you apply any scaling algorithm you want. I haven't benchmarked processing an argb array, because I assumed that looping like this over a large array would be slow. If you apply this technique, I appreciate if you can share how it performs (or may be bikas can do).
06-26-2009 03:13 AM
Yes its a bit slow than scaling an image using Encoded image.
But i think it will give better scaled image than scale using encoded image.
I think sometime you have to sacrifice some performance penalty for quality.
06-26-2009 02:34 PM
Thanks Bikas & cagdasgerede,
But my problem here is the performance and not quality. I am receiving image data over network and I have to resize it (both then way, means up scale and down scale). I am having trouble with encode + resize oprations since it resuluts in a hour glass display and dumping GC messages on console.