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
arsenk01
Posts: 91
Registered: ‎06-21-2011
My Device: Blackberry Torch 9800
My Carrier: developer

Re: How to fetch image from device to bitmap

You can use resizeImage or resizeBitmap methods I mention befor,for example :

 

Bitmap bmp = resizeBitmap(original,90),

which will change the orientation of your image.

Regards,
Arsen
Please use plain text.
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: How to fetch image from device to bitmap

Hi

 

 

Bitmap resizeBitmap(Bitmap image, int width, int height)

 

method has 3 parameters not 2 !!

also what is

rescaleArray(rgb, imageWidth, imageHeight, width, height);

 

method you mentioned in your reply???

 

What will be the overall quality of image after rotation?

I need best similar to that we see when we view our images in inbuild image viewer

 

Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.
Developer
arsenk01
Posts: 91
Registered: ‎06-21-2011
My Device: Blackberry Torch 9800
My Carrier: developer

Re: How to fetch image from device to bitmap

OK,its my fault!

You must use  rotate(Bitmap bitmap, int angle) method(see attachment)

What about image quality,I use this methods and image quality remain quiet good.

 

Regards,
Arsen
Please use plain text.
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: How to fetch image from device to bitmap

Thanks

 

That Worked !!!

I was using this zip but using the wrong method

 

But now the image is cropped !!

 

this would be of no use if I can't get my original Image with proper alignment :smileysad:

 

Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: How to fetch image from device to bitmap

I have tried all scalling options

but the best I get is

 

bb.PNG

vertical line is put by me to show the scalled size of the image

 

ei.getBitmap().scaleInto(bitmap,Bitmap.FILTER_LANCZOS,Bitmap.SCALE_TO_FIT); //producing the above image

 

also SCALE_STRETCH and TO_FIT have been tried

and

 

ei.getBitmap().scaleInto(0, 0, ei.getWidth(), ei.getHeight(), bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), Bitmap.FILTER_LANCZOS);

 

 

How can I get my screen filled completely with the image without loosing any image part or distorting it :smileysad: ?

 

here is the code for scalling and rotating I am using

bitgraphic.clear();
bitmap = new Bitmap(bitmap.getWidth(), bitmap.getHeight()); //bitmap is already defined just resetting it to new object with previous w/h
ei.getBitmap().scaleInto(bitmap,Bitmap.FILTER_LANCZOS,Bitmap.SCALE_TO_FIT);//0, 0, ei.getWidth(), ei.getHeight(), bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), Bitmap.FILTER_LANCZOS);
Background bg = BackgroundFactory.createBitmapBackground(ImageManipulator.rotate(bitmap, angle));
bitmapField.setBackground(bg);
			

 

 

Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to fetch image from device to bitmap

try to scale it manually using http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/system/EncodedImage.html#scale... int)
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: How to fetch image from device to bitmap

I am not able to use scaleImage32

as not able to copy image from EncodedImage obj to bitmap obj using bitmap = ei.getBitamp();

 

I tried to modify my code

On Simulator it worked OK but device scalling problem remain :smileysad:

 

On Simulator it comes as

 

bb2.PNG

 

and On Device it is

 

bb.PNG

 

 

I need serious help from you guys now :smileysad:

 

here is the modified code

bitgraphic.clear();
			//bitmap = new Bitmap(bitmap.getWidth(), bitmap.getHeight());
			Bitmap rot = new Bitmap(bitmap.getHeight(), bitmap.getWidth());
			
			ei.getBitmap().scaleInto(rot,Bitmap.FILTER_LANCZOS,Bitmap.SCALE_TO_FIT);
			Background bg = BackgroundFactory.createBitmapBackground(ImageManipulator.rotate(rot, angle));
bitmapField.setBackground(bg);

 

 

Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: How to fetch image from device to bitmap

Bitmap rot = new Bitmap(bitmap.getHeight(), bitmap.getWidth());

rot width = bitmap height & ro height = bitmap width
as after this scaling I will rotate the image
Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: How to fetch image from device to bitmap

Hi All,

 

I am getting my image as required :smileyhappy:

I didn't chage anything in my code just switched the phone OFF and ON

 

Will do the testing and post the complete code here

 

Thanks 2 All for your support

Abhinav Tyagi :smileyhappy:

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.
Developer
arsenk01
Posts: 91
Registered: ‎06-21-2011
My Device: Blackberry Torch 9800
My Carrier: developer

Re: How to fetch image from device to bitmap

Great!!!

Thank you for kudo!

Regards,
Arsen
Please use plain text.