How to convert the Bitmap Image in BlackBerry
Hello
In my application, I get the picture from the server. Now, I want to convert this Bitmap Image to display on the screen. For this I use below codes. But it doesn't give me the same image does not mean with the clarity and the exact size. He's smaller than the picture.
I used the codes below:
private Bitmap getBitmapFromImg(Image img) { Bitmap bmp = null; try { Logger.out(TAG, "It is inside the the image conversion " +img); Image image = Image.createImage(img); byte[] data = BMPGenerator.encodeBMP(image); Logger.out(TAG, "It is inside the the image conversion---333333333"+data); bmp = Bitmap.createBitmapFromBytes(data, 0, data.length, 1); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return bmp; // TODO Auto-generated method stub }
Here is the BMPGenerator class:
public final class BMPGenerator { /** * @param image * @return * @throws IOException * @see {@link #encodeBMP(int[], int, int)} */ public static byte[] encodeBMP(Image image) throws IOException { int width = image.getWidth(); int height = image.getHeight(); int[] rgb = new int[height * width]; image.getRGB(rgb, 0, width, 0, 0, width, height); return encodeBMP(rgb, width, height); } /** * A self-contained BMP generator, which takes a byte array (without any unusual * offsets) extracted from an {@link Image}. The target platform is J2ME. You may * wish to use the convenience method {@link #encodeBMP(Image)} instead of this. ** A BMP file consists of 4 parts:- *
-
*
- header *
- information header *
- optional palette *
- image data *
Where an error in my code? Is there another way to do the same thing?
Why you want to use a bmp image?
You can just use png, jpg or whatever of the original image is.
If there is a situation where you need the bitmap image call http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/EncodedImage.html#getBi...
Tags: BlackBerry Developers
Similar Questions
-
How to change the bitmap image in blackberry
Hello
1. work on the version of BB storm (9500/9530 Simulator) is v4.7.0.75
2 opportunity BB JDE 4.7
3. the request is:I display a bitmap image by using the drawBitmap method. now I want to select a portion of the bitmap, and then I need to cut & paste the part somewhere in the screen (MSPaint we have option 'Select').
is there any method that will make the similar operation (or) any idea to accomplish this in blackberry.
Thank you
Sendhil Kumar V
Take a look at this thread and refers to the J2ME code:
http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=24929
The 'trick' is getARGB() and setARGB(). As long as you check out relevant Bitmap Moose ARGB values, you should be able to create a new Bitmap. That said, I never did. Let us know how you go.
-
How to use the Gif image in Blackberry android runtime
Hello
I deploy an android app in blackberry 10. All that it works well in blackberry 10 except gif image. In app android gif image is displayed using the AnimationDrawable from the link
http://developer.Android.com/reference/Android/graphics/drawable/AnimationDrawable.html
So how to use blackberry 10.
Is it possible to use GIFs in blackberry 10.
Please suggest.
Thanks in advance.
Hello
I found the solution.
He needs of the gifDecoder and gifDecoderView classes and following code extract
Mode, mode = inflate.inflate (R.layout.layout_gspot, null);
GIF GifDecoderView = view.findViewById (R.id.gifView) (GifDecoderView);
gif.setGifImageFromAssets ("abc.gif");and following the layout code
<>
Android:ID="@+id/gifView".
Android: layout_width = "120dp."
Android: layout_height = "120dp."
Android:layout_alignLeft="@+id/textView1".
Android: layout_centerVertical = "true".
Android:background="@Android:color/transparent" / > -
Please how to convert the photo to the second
Please guys how to convert the kia rio pictures the second perfect like this, and with any program, I know that all steps in details please its very important
That looks just like you would use the tool pen to redraw on the image and create shape layers (black areas). It could be done in Photoshop or Illustrator.
-
How to convert the following code in as3?
As the title says... How to convert the following code to as3?... Thanks in advance.
import flash.display.BitmapData;
linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap (linkageId);
MC = this.createEmptyMovieClip ("mc", 1);
mc.attachBitmap (myBitmapData, 1);onMouseMove = function() {}
myNewColor = "0 x" + myBitmapData.getPixel(_xmouse,_ymouse).toString (16);
newColor.setRGB (myNewColor);
selectedColor.colorValue.text = myNewColor;
}
selectedColor.swapDepths (_root.getNextHighestDepth ());
newColor = new Color (selectedColor.sample);:
var myBitmapData:landscape = new landscape (0,0);
var bmp:Bitmap = new Bitmap (myBitmapData);
addChild (bmp);stage.addEventListener (MouseEvent.MOUSE_MOVE, f);
function f(e:MouseEvent):void {}
var myNewColor:String = "0 x" + myBitmapData.getPixel(mouseX,mouseY).toString (16);
newColorTransform.color = uint (myNewColor);
selectedColor.sample.transform.colorTransform = newColorTransform;
selectedColor.colorValue.text = myNewColor;
}
addChild (selectedColor);
var newColorTransform:ColorTransform = selectedColor.sample.transform.colorTransform; -
How to disable the PNG Images?
PNG is a format for images (compressed) as JPG format. There is no way to disable this format.
If you have a problem with images on web pages, then you will need to block images from certain domains.
You can watch the Adblock Plus extension to block specific content.
- Adblock more: https://addons.mozilla.org/firefox/addon/adblock-plus/
You must subscribe to a list of filters (for example the EasyList).
-
How to convert the precision extended float to float in C++
Hello
Could someone me please how to convert the extended precision (floatExt) float normal float in C++?
What is the difference in the float between Labview and C++ data type?
When I tried to receive a range of float of a function of the DLL generated by Labview in C++, data are bad.
Thank you
Victor King
You can search for numeric data types in LabVIEW help for more information on the different types of data. Before sending the data to the C++ application, you can use the function of Double precision on digital / range of Conversion to convert number to Double precision.
-
How to correct the bad image applesynofer.exe
How to correct the bad image of apples synotifer.exe
Contact apple.
-
How to convert the date in milliseconds?
Hi all
Can I know how to convert the date in milliseconds?
My current datetime like this Formate
QDateTime::currentDateTime (m:System.NET.SocketAddress.ToString ("MMMM dd, yyyy HH"))
Seconds since January 1, 1970
http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toTime_t
Sinds milliseconds January 1, 1970
http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toMSecsSinceEpoch
-
How to use the gateway carrier on BlackBerry J2ME WAP?
How to use the gateway carrier on BlackBerry J2ME WAP? Because the default gateway on BlackBerry is "blackberry.net". How to hard code in the application to force the application to use the WAP gateway? An example of code? Thank you!
You can specify the specific settings of the WAP gateway within the Connector.open () method. There is a knowledge base of any developer this article here:
http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is_-_Different_ways_to_make_an_HTTP_or_socket_connection.html?nodeID=826935&vernum=0
-
How to set the background image on my request.
Hi all
I use jdev 11.1.2.4.0 version
use case: I create mobile applications and using the skin by default 'mobileFusionFx '.
so when I run application there show black screen as a background image on my application
My question is how to change the background image.
Thank you
Manish
Resources of the Application open-> descriptors-> ADF META - INF-> adfmf-config. XML
Check the family skin it and use in the skin of skin-addition id attribute.
With this way automatically all your pages will use the same background image.
In addition, background - image: url("images/back.png"); ---> It denotes that this images folder is inside the css file. If the pictures folder is a brother to css file, use
background-image: url("..) (' / images/back.png ');
-
How I see the preview image of my PDF documents?
How I see the preview image of my PDF documents?
Hi josepm26085232,
Preview of thumbnails has been disabled in the latest Adobe Acrobat Reader DC due to security problem.
If you want this feature, you will need to uninstall the latest version & reinstall the old version of the Adobe - Adobe Acrobat Reader DC Distributiondrive.
Kind regards
Nicos -
Hello, I have a full desktop in Adobe Muse, site and I want to convert it into a version Tablet & phone, then, how would convert the site Office to Tablet & phone to copy the entire office content and site structure? Thanks for any help.
You can not automatically convert. Click on the "tablet" or "Phone" at the top of your plan view to create these versions.
You can then copy and paste on any content you want has more of your office.
-
How to print the specific image size?
Hi Gang - How can I print an image 11 x 15 "on paper 13 x 19"? Initially, it seems easy, but things are not how to navigate. Here's what I did:
I exported the photo and used the dialog box LR image resize to 11 x 15 "- easy."
I imported the exported image (assuming that the image was 11 x 15 ") and then in the LR print area - it is where the confusion begins.
The print tab displays the dimensions of the image as 8 x10.19 in. Help, how can I do the 11 x 15 "I need it to be?
I understand that I will need to adjust the image to get the part I want in the space of 11 x 15, but for the moment, I can't even 11 x 15 "size.
I tried package customized options, but no luck there.
I would like to Print Studio Pro Canon plugin that works very well. Except, again, I don't know how to ask the image size 11 x 15 "for printing on paper 13 x 19".
Fiddling with settings, I printed a dozen attempts and still no luck to reach 11 x 15 "size of the image on paper 13 x 19". For now, I'm OK with the image to cut or to another plane - no baby - I need to know how to make the print image 11 x 15 "size of the image. A
Thank you to offer suggestions.
Screenshot shows that my image 11 x 15 "is 8x10.19; I don't know how 11 x 15 ".
LR v5.7
Mac OS X Yosemite v10.10.2
Brain: generally intuitive, but need some help on this issue!
The first step in the Lightroom print module is to click on the Page Setup button, select your printer, and then select the paper size. It looks like your screen to paper size correct has not been selected yet, because you said you wanted to print on paper 13 x 19 inches, but the paper on the screen is only 8.5 inches wide. My guess is that Page Setup is always programmed for letter-size paper, and you should come back on layout and change it. After you do this, if your layout Style is unique, you should be able to affect the size of the cell 11 x 15 inches.
-
How to mount the iso image on the ESXi Tech support console
Hi friend
How to mount the iso image on the ESXi Tech support console?
I run the sub command and it failed.
# mount o loop-t iso9660 vmware-esx-drivers-net-be2net_400.2.102.440.0-1vmw.2.17.249663.292682.iso / free
editing: vmware-esx-drivers-net-be2net_400.2.102.440.0-1vmw.2.17.249663.292682.iso mounting on / open failed: no such device
ESXi does not provide the option of mounting ISOs. You try to install the driver the driver Async package be2net / ISO. Follow the steps below
(1) install VCLI
(2) mount the ISO on the host where you installed vcli
(3) use vihostupdate to install the driver
vihostupdate-i b- servername
He will ask for username and password of your host.Thank you
Nithin
Maybe you are looking for
-
Satellite L - How to fix the keys?
remember what my user name, when you read this... lol and forgive me. the cat "fell" on my laptop somehow and ripped off the SHIFT key and on my old laptop, they just jumped in his place, but for some reason any I can't sit tight plus, I have the whi
-
Satellite A660-1FM - maximum resolution of the display of the external monitor
Hi all Maybe it is (probably) an easy question to answer, but I have a Satellite A660-1FM and want to use it with my external screen Samsung Syncmaster (forgot model). I got a HDMI-> DVI - D adapter and everything is going well, but here's my questio
-
Satellite U200-160 - Noicy CPU fan - where to get a new
Anyone know where I can get a new CPU fan?Please I'm running the processor power less noise, but the result of this is that the pc is running more slowly than normal.
-
where do downloads removed when new versions are uploaded and deleted the 'old'?
my internet secuity program found some vulnerable older downloads that require an update. I downloaded the latest versions and then deleted the 'old' in the control panel. (Picasa) appears on page downloaded 3.9 but when I try to install it says ve
-
problem with windows media center
I downloaded a few podcasts of the audible. They appear in microsoft media center but but not in sound Manager. When I try to synchronize their windows Media Center says "connect a device". I tried all the slots and am able to make audible manager