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


Iwill DNS-SATA E7520 Intel Chipset eATX Xeon Socket 604 Server Board picture

Iwill DNS-SATA E7520 Intel Chipset eATX Xeon Socket 604 Server Board

$195.00



Intel R1208GZ4GC Server picture

Intel R1208GZ4GC Server

$375.00



NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM picture

NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM

$144.49



1 Pc Home Intel Xeon Silver Sclip 4110 Linux   - NEW picture

1 Pc Home Intel Xeon Silver Sclip 4110 Linux - NEW

$245.00



Kit xeon Maxgeek DSE6020 MKII Generator Controller Generator Set Control Panel picture

Kit xeon Maxgeek DSE6020 MKII Generator Controller Generator Set Control Panel

$132.00



Trenton 92-506313-XXX W/ 2x Intel Xeon Processors & 4GB DDR2 RAM picture

Trenton 92-506313-XXX W/ 2x Intel Xeon Processors & 4GB DDR2 RAM

$110.00







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