BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-18-2009, 05: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, 12:55 PM   #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, 02: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, 08: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





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