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


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.


Reply
Contributor
Posts: 24
Registered: ‎07-08-2010
My Device: Blackberry 9000
My Carrier: ATT
Accepted Solution

Re-size Encoded Images before Adding it to a BitmapField

I am having issues re-sizing my image. I click an image using the camera and store it in the pictures folder. When I retrieve the image I see the image on the screen but I want it to be smaller since it occupies the entire screen and more and I have to scroll down. I added the code to scaleImage, (see the red coded linebelow) but no luck. Am I doing something wrong? - Thank you.

 

 

EncodedImage image = EncodedImage.createEncodedImage(dataArray, 0, dataArray.length

image.scaleImage32(1, 1);

 

BitmapField bitmapField = new BitmapField();

bitmapField.setImage(image);

 

add(bitmapField);

 

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Re-size Encoded Images before Adding it to a BitmapField

scaleImage32 used a Fixed32 number. This means you either need to called Fixed32.toFP(*num*) or the code equivilant which is *num* * 65536 (0x10000).

 

The documentation should explain it pretty well.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Contributor
Posts: 24
Registered: ‎07-08-2010
My Device: Blackberry 9000
My Carrier: ATT

Re: Re-size Encoded Images before Adding it to a BitmapField

I changed the image.scaleImage32(1,1) to image.scaleImage32(100,100) and still no luck. Maybe I dont understand how scaling works. I thought the bigger the number the smaller the size. Any thoughts would be appreciated. Thanks.

Contributor
Posts: 24
Registered: ‎07-08-2010
My Device: Blackberry 9000
My Carrier: ATT

Re: Re-size Encoded Images before Adding it to a BitmapField

sorry, I was reading the document as you wrote a reponse. I still can't figure it out, I want to reduce the image to 50% of it's size. I dont know how to call Fixed32.toFP(), is that a function call in the image? - Thanks for your time.

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Re-size Encoded Images before Adding it to a BitmapField

Take a look at net.rim.device.api.math.Fixed32.  Or, when you read documentation on encodedImage.scaleImage32, click on one of the Fixed32 links (should be easy Smiley Happy ).

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Highlighted
Contributor
Posts: 24
Registered: ‎07-08-2010
My Device: Blackberry 9000
My Carrier: ATT

Re: Re-size Encoded Images before Adding it to a BitmapField

fixed32.tofp did it. thanks