BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-18-2009, 04:52 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Posts: 73
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default how to make a monochrome JPEGEncodedImage?

Please Login to Remove!

hi,
i'm making a screenshot of the device screen, store it into bitmap and then encode it into JPEGEncodedImage. but this image must be black and white.. how can i do that?
here is the code that i use:
Code:
Bitmap _bitmap = new Bitmap(Display.getWidth(), Display.getHeight());
Display.screenshot(_bitmap);
JPEGEncodedImage _image= JPEGEncodedImage.encode(_bitmap, 50);
how can i do JPEGEncodedImage to be monochrome??

kind regards
Offline  
Old 04-19-2009, 11:55 AM   #2 (permalink)
New Member
 
Join Date: Apr 2009
Model: 9530
PIN: N/A
Carrier: no
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have the same question
Offline  
Old 04-20-2009, 01:08 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Posts: 73
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i've found a solution. here is the code:
PHP Code:
Bitmap bmp = new Bitmap(Display.getWidth(),Display.getHeight());Display.screenshot(bmp);int x=0;int y=0;intxxx91;xxx93; argb = new intxxx91; bmp.getWidth() * bmp.getHeight() xxx93;;bmp.getARGBargb0bmp.getWidth(), xybmp.getWidth(), bmp.getHeight() );for ( int i argb.length 1>= 0; --)        {            int alpha argbxxx91;ixxx93; >> 24;            int red = (argbxxx91;ixxx93; >> 16) & 0xFF;            int green = (argbxxx91;ixxx93; >> 8) & 0xFF;            int blue argbxxx91;ixxx93; & 0xFF;                        int grey = ( red green blue ) / 3;                        int composite = (alpha << 24) | (grey << 16) | (grey << 8) | grey;                        argbxxx91;ixxx93; = composite;        }                                     bmp.setARGBargb0bmp.getWidth(), xybmp.getWidth(), bmp.getHeight()    );JPEGEncodedImage je JPEGEncodedImage.encode(bmp100); 
kind regards
Offline  
Old 04-20-2009, 07:01 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Thanks for posting your solution.
Offline  
Closed Thread


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Wells RCTS-4 Refrigerated Server
$599.0
Wells RCTS-4 Refrigerated Server pictureCake/Pancake Server4In X 2In S242 1/2
$48.64
Cake/Pancake Server4In X 2In S242 1/2 pictureDell PowerEdge 1950 E1624 Server (9423)
$24.95
Dell PowerEdge 1950 E1624 Server (9423) pictureDC Fan 6020 12V 0.3A 5700RPM Audio Server Power Supply Cooling Fan x1pcs
$4.5
DC Fan 6020 12V 0.3A 5700RPM Audio Server Power Supply Cooling Fan x1pcs pictureB & B Electronics V Linx Ethernet Serial Server Model ESR902
$79.99
B & B Electronics V Linx Ethernet Serial Server Model ESR902 picture






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