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
Posts: 139
Registered: ‎10-24-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: du

Reduce Image Size like BBM

hi Guys,

 

I want to reduce my image size.

 

on BBM when we send the image there are three to four option come. like 

 

original  1024 x 768    size = 140.5kb

 

Medium 800 x 600      size = 85.8 kb

 

Small     640 x 480size = 54.9 kb

 

 

But whe i Try to resize image I did'nt get exact or near reslut of BBM.  

I try EncodedImage.scaleImage32(640,480)

Also try this functio

public Bitmap setsizeImage(EncodedImage image, int width, 
    		  int height) {
    		  EncodedImage result = null;

    		  int currentWidthFixed32 = Fixed32.toFP(image.getWidth());
    		  int currentHeightFixed32 = Fixed32.toFP(image.getHeight());

    		  int requiredWidthFixed32 = Fixed32.toFP(width);
    		  int requiredHeightFixed32 = Fixed32.toFP(height);

    		  int scaleXFixed32 = Fixed32.div(currentWidthFixed32,
    		    requiredWidthFixed32);
    		  int scaleYFixed32 = Fixed32.div(currentHeightFixed32,
    		    requiredHeightFixed32);

    		  result = image.scaleImage32(scaleXFixed32, scaleYFixed32);
    		  return result.getBitmap();
    		 }

 

I scale the image on 200,200  but size become 180 kb of 331

But BBM reducing more with large scale.

 

plz help me if anybody now about it.

 

 

 

--
please mark posts as solved if you found a solution.
press the like button on the right side to thank the user that helped you.
------------------------------------------------------------
Riz
Trusted Contributor
Posts: 159
Registered: ‎02-17-2011
My Device: Not Specified

Re: Reduce Image Size like BBM

[ Edited ]

can u post ur code?

 

and also tell about  version 

Developer
Posts: 723
Registered: ‎03-12-2009
My Device: Playbook

Re: Reduce Image Size like BBM

Developer
Posts: 139
Registered: ‎10-24-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: du

Re: Reduce Image Size like BBM

thanks for reply.

 

I Try bitmap scaleInto.. but its not reducing size of image. it is doing scale well.

 

But I also want to reduce the image file size.

--
please mark posts as solved if you found a solution.
press the like button on the right side to thank the user that helped you.
------------------------------------------------------------
Riz
Developer
Posts: 723
Registered: ‎03-12-2009
My Device: Playbook

Re: Reduce Image Size like BBM

Not sure if BBM does this, try converting it to a JPEG and playing with different quality of JPEG.

That should reduce the size considerably, if JPEG is acceptable for you.
Developer
Posts: 139
Registered: ‎10-24-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: du

Re: Reduce Image Size like BBM

yes Jpeg is acceptable even I am doing with jpeg. I am also thinking how BBM is doing. I use JPEGEncodedImage, EncodedImage, PNGEncoder but all these techniques work with scale well. but when i convert large scale image to smal it should be decrease size. ex

I have image of 331 kb 1900 x 1200
when i scale it in 640 x 480 file size become 700+ kb but scale working well.
if image size is 2MB then also its converting size 7 to 800 kb.

But BBM is reducing image file size very well
--
please mark posts as solved if you found a solution.
press the like button on the right side to thank the user that helped you.
------------------------------------------------------------
Riz
Developer
Posts: 139
Registered: ‎10-24-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: du

Re: Reduce Image Size like BBM

any one?
--
please mark posts as solved if you found a solution.
press the like button on the right side to thank the user that helped you.
------------------------------------------------------------
Riz
Highlighted
Developer
Posts: 139
Registered: ‎10-24-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: du

Re: Reduce Image Size like BBM

plz help me still facing this problem

--
please mark posts as solved if you found a solution.
press the like button on the right side to thank the user that helped you.
------------------------------------------------------------
Riz