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
Contributor
SandeepKumar
Posts: 38
Registered: ‎05-24-2011
My Device: Blackberry Bold 9700
My Carrier: Airtel

Stroing image in persistent store

Hi,

 

Is there a way to reduce the size(not rescale) of an image??

Havn't found any api. 

 

 

Can we store an scaled Encoded image in persistent store so that we dont have to scale it everytime while picking up from the persistent store 

Please use plain text.
Developer
maadani
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: Stroing image in persistent store

Hi Sandeepkumar,

 

Regarding your first question, it depends on the image that you have. I.E., if you have a bitmap image then you can try and use the PNGEncodedImage.encode to convert the image to a PNG format which probably reduce the image size.

On the other hand, it's usually more efficient to get the image as PNG rather then encoding it.

 

Regarding your second question, I'm not sure I understand your question.

Your can use the persistent storage to keep your images (scaled or not).

If you are keeping them scaled but you need to rescale them again, there might be a problem with your code.

 

E.

 

Please use plain text.
Contributor
SandeepKumar
Posts: 38
Registered: ‎05-24-2011
My Device: Blackberry Bold 9700
My Carrier: Airtel

Re: Stroing image in persistent store

Hi maadani,

 

Thanks for the reply.

 

the problem is that in persistent store we can only store data that are persistable so  we have to store the image in form of byte array or string. Currently using EncodedImage.getData to get the image in byte [] form but it return the decodedd image so the image is again converted to original size.

 

Please use plain text.
Developer
maadani
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: Stroing image in persistent store

Hi Sandeepkumar,

 

You would need to convert your image to bitmap, scale it and then encode it.

 

Check out the Bitmap class for your preferred scaling method.

 

E.

Please use plain text.