BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 01-05-2009, 01:37 AM   #1
aykarthik
New Member
 
Join Date: Nov 2008
Model: 8120
PIN: N/A
Carrier: wifi
Posts: 3
Default Conversion from bitmap object to bitmap image

Please Login to Remove!

Hi guys,

I captured the screenshot of device. This is like a bitmap object. I need to convert from this bitmap object to bitmap image. Is it possible in Blackberry?

Please help me out through this.

Thanks in advance,
Offline  
Old 01-05-2009, 01:45 AM   #2
daphne
BBF Spam Killer Moderator
 
daphne's Avatar
 
Join Date: May 2007
Location: on a sunny beach
Model: Paspt
OS: 10.3.0.90
PIN: X1ZPY34K
Carrier: VZW but not for long
Posts: 9,176
Default

What program did you use to capture the screenshot? Is the file on your PC or on the device? What is the file name and extension?
__________________
Report spam text messages to 7726
#BlackBerry by choice
Offline  
Old 01-05-2009, 04:14 AM   #3
aykarthik
New Member
 
Join Date: Nov 2008
Model: 8120
PIN: N/A
Carrier: wifi
Posts: 3
Default

I used this code to capture the screen shot.

Bitmap bitmap = new Bitmap(width, height);
Display.screenshot(bitmap);

After taking the screenshot I can convert from bitmap object(screen captured data) to ".JPG" and ".PNG" image formate also using this JPEGEncodedImage.encode(bitmap)

But BMPEncodedImage doesn't have encode method so i am using

byte[] _bytes = getBytesFromBitmap(bitmap);

BMPEncodedImage.createEncodedImage(_bytes ,0,_bytes .length);

while am using this method its throws "IllegalArgumentException".
Then using Fileconnection to save the image in device memory.

public byte[] getBytesFromBitmap(Bitmap bmp) {
try {
int height=bmp.getHeight();
int width=bmp.getWidth();
int[] rgbdata = new int[width*height];
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
Graphics g = new Graphics(bmp);
bmp.getARGB(rgbdata,0,width,0,0,width,height);
for (int i = 0; i < rgbdata.length ; i++) {
if (rgbdata[i] != -1) {
dos.writeInt(i);
dos.flush();
//l++;
}
}
bos.flush();
return bos.toByteArray();
}
catch (Exception ex) {
Dialog.alert("getBytesFromBitmap: " + ex.toString());
return null;
}
}

I need to know whether Blackberry supports saving the captured image into raw BMP format.
Also, can we directly capture images into a specified format like 1bit, 4bit mono, 4bit color, 8bit, 16bit etc)..
Offline  
Old 01-05-2009, 12:55 PM   #4
daphne
BBF Spam Killer Moderator
 
daphne's Avatar
 
Join Date: May 2007
Location: on a sunny beach
Model: Paspt
OS: 10.3.0.90
PIN: X1ZPY34K
Carrier: VZW but not for long
Posts: 9,176
Default

Sorry, I don't know code. There are a few apps that will do screenshots on the BlackBerry. I think that would be a lot easier than what you're trying to do.

JL_Cmder is one -- can be found on forum search.
http://www.blackberryforums.com/afte...n-capture.html

I think there's another one, but I can't remember for sure.
__________________
Report spam text messages to 7726
#BlackBerry by choice
Offline  
Old 01-05-2009, 11:43 PM   #5
aykarthik
New Member
 
Join Date: Nov 2008
Model: 8120
PIN: N/A
Carrier: wifi
Posts: 3
Default

Thanks for your reply Daphne.
Offline  
Old 01-07-2009, 01:26 AM   #6
daphne
BBF Spam Killer Moderator
 
daphne's Avatar
 
Join Date: May 2007
Location: on a sunny beach
Model: Paspt
OS: 10.3.0.90
PIN: X1ZPY34K
Carrier: VZW but not for long
Posts: 9,176
Default

It occured to me -- if you are a developer, you should post in the developer's forum here. You might get some help there.
__________________
Report spam text messages to 7726
#BlackBerry by choice
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Jelenko Commodore LS VPF with Pump  picture

Jelenko Commodore LS VPF with Pump

$875.00



Vintage MOS 8502 8502R0 Commodore C64 very rare good condition x 1pc picture

Vintage MOS 8502 8502R0 Commodore C64 very rare good condition x 1pc

$22.00



6500/1 A 6502 VARIENT CPU COMMODORE USE IN AMIGA KB & 1520 PLOTTER NMOS NCR NOS picture

6500/1 A 6502 VARIENT CPU COMMODORE USE IN AMIGA KB & 1520 PLOTTER NMOS NCR NOS

$5.89



MCR 6003L Commodore PVC/Non-Woven Poly/Nylon RAIN Suit 3 PC YELLOW  SIZE LARGE picture

MCR 6003L Commodore PVC/Non-Woven Poly/Nylon RAIN Suit 3 PC YELLOW SIZE LARGE

$13.99



Windsor Commodore Duo 20

Windsor Commodore Duo 20" Carpet extractor w/Lester Charger 25900/Battery/99hour

$2501.99



Vintage Printer Switch box Commodore 64/Sanyo Mountable Computer PC picture

Vintage Printer Switch box Commodore 64/Sanyo Mountable Computer PC

$49.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.