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

BLACK 60 T0N RAM, 1 1/4 HOLLOW HOLE DOUBEL ACTION, 11/16 IN STROKE.
$490.0
BLACK 60 T0N RAM, 1 1/4 HOLLOW  HOLE DOUBEL ACTION, 11/16 IN STROKE. pictureHigh Power Dpss Nd:Yag YVO4 IR Raman Laser Resonator Optic Crystal Module 946nm
$25.55
High Power Dpss Nd:Yag YVO4 IR Raman Laser Resonator Optic Crystal Module 946nm pictureDodge Ram 2500 & 3500 6.7L 2012 Cummins DPF Diesel Particulate Filter Mopar
$425.0
Dodge Ram 2500 & 3500 6.7L 2012 Cummins DPF Diesel Particulate Filter Mopar pictureVintage Ram-Air Touch-up Spray Gun & Cup. New old stock.
$19.0
Vintage Ram-Air Touch-up Spray Gun & Cup.  New old stock. pictureNEC D5101LC, 256 x 4-bit Static CMOS RAM, 4ea. NEW OLD STOCK
$39.95
NEC D5101LC, 256 x 4-bit Static CMOS RAM, 4ea. NEW OLD STOCK picture






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