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

NTE Electronics NTE458 N-Channel Silicon JFET Transistor for General Purpose and
$16.42
NTE Electronics NTE458 N-Channel Silicon JFET Transistor for General Purpose and pictureTOSHIBA IIGBT Module MG400Q1US41 – 400 Amp 1200 Volts
$25.0
TOSHIBA IIGBT Module MG400Q1US41 –  400 Amp 1200 Volts picture JAN 1n93a NOS diode
$7.99
 JAN 1n93a  NOS diode picturePhillips ECG Transistor ECG 51- NEW
$4.0
Phillips ECG Transistor   ECG 51- NEW picturePhillips ECG Transistor ECG 5460 - NEW
$4.0
Phillips ECG Transistor   ECG 5460 - NEW picture






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