How to convert byte [] EncodedImage rgb565 or bitmap data
Hi all I am playing a video and I want to get snapshot of video as
Byte [] byteArr = videoControl.getSnapshot ("encoding = rgb565");
I try to get the Bitmap as
image = EncodedImage.createEncodedImage (byteArr, 0, byteArr.length);
image bitmap = image.getBitmap ();
but she throws an Exception as IllegalArgumentException.
I get a table of double length than screenWidth * ScreenHeight, perhaps because of the rgb565
How can I convert a byte [] bitmap.
I solve the problem to get the bitmap by building as
image bitmap = new Bitmap (Bitmap.ROWWISE_16BIT_COLOR, Graphics.getScreenWidth (), Graphics.getScreenHeight (), byteArr);
Tags: BlackBerry Developers
Similar Questions
-
[Oracle 8i] How to convert a string (timestamp) in a date?
I find it difficult to know how to convert a string to a date time stamp (or possibly several).
The timestamp is 20 positions, character (NOT NULL, CHAR (20))
in the format: YYYYMMDDHHMMSSUUUUUU
where Y = year, M = month, D = day, M = Minutes, S = seconds and U = microseconds
The reason why I want to convert it is so that I can compare a timestamp to each other (that is, I want to be able to find the MIN (timestamp), MAX (timestamp) and make comparisons of inequality).
Is this possible?
Thanks in advance for the help on this!Hello
As Damorgan said, if all you want to do is find which is the earlier or later, then you can just compare the strings: they are in a format where it works.
If you need to do other things, such as compare to today date or see the difference between two of your lines of days, you will need to convert it to date. (He has no reason to convert them to numbers).
A new TIMESTAMP data type, which manages the fractions of a second, was introduced in Oracle 9.
Since you use Oracle 8 (depending on your subject line), or it must be
(1) ignores the microseconds, or
(2) use a separate column for microseconds.Whatever it is, use TO_DATE to convert the first 14 characters in DATE:
TO_DATE ( SUBSTR (txt, 1, 14) , 'YYYYMMDDHH24MISS' )
where txt is your column of type CHAR.
To convert microseconds to a number (between 0 and 999999):TO_NUMBER (SUBSTR (txt, 15))
-
I want to use for LED or photo
10 V to ai0 reciece ex to see the LED or photo on front panel
Help me please
As part of the comparison, it should look like this.
Freelance LV cited above, you must provide additional information to get an apt solution
-
How to convert java.sql.ResultSet to intradoc.data.DataResultSet
I used a MS jdbc driver to perform a query and got a java.sql.ResultSet.
Now when I try this
DRS DataResultSet = new DataResultSet();
ResultSet rs = stmt.executeQuery (sqlString);
Drs.Copy ((intradoc. (Data.ResultSet) rs);
I get an error "ClassCastException.
But they compile even without the cast.
I also tried this:
{while (RS. Next())}
trace ("CPC" + rs.getString (1));
String s = rs.getString (1);
Vector v = new Vector < String > < String > ();
v.Add (s);
drs.addRow (v);
}
and I get an error
Caused by: java.lang.Error:! syFailedAppendRow
Is there a way to do it (or something)? Y at - it the javadoc for intradoc.data.DataResultSet?
I'm using eclipse and JRE 1.5
And injectors scanner stellant 10gr 4
Thank you
Published by: kgough on March 2, 2011 06:36If this does not work, you can always try something like this
public static DataResultSet toDataResultSet( final java.sql.ResultSet p_resultset, final boolean p_closeAfterCopy ) throws SQLException { final ResultSetMetaData rsmd = p_resultset.getMetaData(); final int columnCount = rsmd.getColumnCount(); // get headings final String[] columnNames = new String[ columnCount ]; final int[] columnTypes = new int[ columnCount ]; for ( int i = 0 ; i < columnCount ; i++ ) { columnNames[ i ] = rsmd.getColumnName( i + 1 ); columnTypes[ i ] = rsmd.getColumnType( i + 1 ); } final DataResultSet dataResultSet = new DataResultSet( columnNames ); while ( p_resultset.next() ) { Vector row = new Vector(); for ( int i = 0 ; i < columnCount ; i++ ) { final int fieldType = columnTypes[ i ]; //if ( fieldType != Types.CHAR || fieldType != Types.VARCHAR ) { // // if you want stuff other than string, do smart stuff here //} row.add( p_resultset.getString( i + 1 ) ); } dataResultSet.addRow( row ); } if ( p_closeAfterCopy ) { p_resultset.close(); } return dataResultSet; }
-
How to convert the object Bitmap to byteArray.
Hi all
I had a problem in the conversion of the bitmap object to. BMP file.
(Real need: capture the screen shot and convert that turned to the screen.) BMP image and I have to keep this image in the SCARD
I shouldn't use any PNGEncodedImage or JPEGEncodedImage )
I capture the screen shot using the
Bitmap BM = new Bitmap (width, height);
Display.screenshot (WB);
to get the data from [] bytes of this bitmap object that I use
Byte [] _bytes = getBytesFromBitmap (bitmap);
public byte [] getBytesFromBitmap (Bitmap bmp) {}
try {}
int height = bmp.getHeight ();
int width = bmp.getWidth ();
int [] rgbdata = new int [width * height];
ByteArrayOutputStream Bos = new ByteArrayOutputStream();
DataOutputStream back = new DataOutputStream (bos);
Graphics g = new Graphics (bmp);
bmp.getARGB(rgbdata,0,width,0,0,width,height);
for (int i = 0; i)< rgbdata.length="" ;="" i++)="">
If (rgbdata [i]! = - 1) {}
dos.writeInt (i);
back. Flush();
//l++;
}
}
Bos.Flush ();
Return bos.toByteArray ();
}
catch (Exception ex) {}
Dialog.Alert ("getBytesFromBitmap:" + ex.toString ());
Returns a null value.
}If I use this byte array in the Sub statement I get the "IllegalArgumentException".
BMPEncodedImage.createEncodedImage (_bytes, 0, _bytes .length);
all can help me how I can get the byte [] data from the bitmap object?
import java.io.ByteArrayOutputStream;import java.io.DataOutputStream;import java.io.IOException; import javax.microedition.lcdui.Image; /** * @author Samuel Halliday */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. *
http://javablog.co.uk/2007/12/26/j2me-bitmap-encoder/* A BMP file consists of 4 parts:- *
- *
- header *
- information header *
- optional palette *
- image data *
-
Convert byte [] to bitmap
How convert byte [] bitmap and convert bitmap to byte [] image and when to get the image of the server back to a string how to parse this string for byte [] exmple in android it parse like that
byte[] logoImg = Base64.decode(jLogo.getString(i), 0);
Thanks in advance
Hello
You can use the method createBitmapFromBytes of the Bitmap class to convert an array of bytes to a Bitmap image. If you know that the image will be in PNG format you can even use createBitmapFromPNG
Specification of the API:
-
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... -
How to convert hex 8 bytes floating point double?
Hello
I want to know how to convert a string of 8 bytes of data double floating-point.
data (HEX): 40 02 70 40 00 00 00 4F
Thank you.
DP
This string of 8 bytes of data is actually a string? Are the characters in the string of letters or you have hex values? Ultimately you want to use the Type Cast:
-
Don't know how to read the results of netstat EI s list? If I received 860592506 bytes sent from 43421482 how to convert MB? And does this mean byte received?
Hello
This shows the total number of bytes transmitted and received via the Ethernet card. This is the total of the amount of use up to this day.
This includes all the Web sites you have visited and emails you sent, etc..
You can calculate using one of the following methods:
Method 1:
860592506 / 1048576 = 820,72 MB
Method 2:
Multiply 860592506 with 9.53674316 * 10 ^-7 that will give us the result in mega bytes.
860592506 bytes = 820 MB 9MB not, accept my apology for the miscalculation.
Similarly 43421482 acroos = 40MB -
How to convert an array of char byte array?
Hello
Someone can say, how can I convert Byte char []?
Thank you
What:
data Byte [] =...
Char [] charArr = (new String (data)) .toCharArray ();
Rab
-
How to convert a single byte String?
Purpose:
Show a result byte on the BB 9900 screen.
Question:
How to convert a single byte String?
Part of the code:
byte value = con.cpu_config.elementAt (i)
stop here
String valuestring = new String (value);
_rtf. SetText (valueString);
If you know how to fix it, please share your idea.
Thank you for your attention,
String valuestring = new String (new byte [] {value}};)
_data. Append (valueString);
_rtf. SetText (_data.toSrting ());
Solve it.
-
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 convert pictures from iPhoto? I need general info and advice. I saw the help info but I am very nervous to take on this project, as my library is huge (95GB), organized in several events and albums. My library is saved (Time Machine SimpleSave HD). I am running OSX El Capitan 10.11.6 on iMac.
Have you seen this document? Updated Photos for OS X - Apple iPhoto support
https://support.Apple.com/en-GB/HT204655
Is your iPhoto Library Library on your system drive in the pictures folder? And you have a lot of free space on your system drive? The migration will need additional temporary storage.
Then drag the iPhoto library icon pictures open to create a new library of Photos of her.
Your albums appear unchanged in the Photos. Events will appear as additional albums, because the pictures has no events. See this link: How Photos handles content and metadata for iPhoto and Aperture - Apple Support
-
How to convert WAV, Alac
How to convert WAV to ALAC files.
- Select Apple Lossless as your chosen import format using edit > Preferences > import settings.
- Choose files to convert.
- Use file > convert > create the Version Apple Lossless.
TT2
-
How to convert .pdf to .epub
Please see me step by step how to convert .pdf to .epub
Hello PrasanW.
Thank you for using communities Support from Apple. I see your message that you want to convert PDF files into ePub files.
Read this article.
Creating ePub with Pages files
Have a great day.
Maybe you are looking for
-
I have spelling mistakes in email, but the spelling is not checked. Even when I highlight the word and click on check the spelling on the box opens, but the spelled word is not displayed. If it is a blank form.
-
Wireless KB-1450: 1450 KG wireless keyboard
Have had my HP Pavilion about a month and now the wireless keyboard keeps in letters or numbers even if I stop typing. Also crashes and don't enter anything for a few seconds. This only happens with some Web sites. For example, type in this forum
-
When I reinstall El Capitan on a new drive, should I install device drivers?
I am completely new to the Mac, after using Windows all my life. My question is; I'll put a new, larger internal SSD in my MacBook Pro and of course re - install El Capitan. I need to download and install device drivers, as you do with Windows machi
-
How to get ereader will appear on the desktop
I have a MacBook (retina, 12 inch, early 2015), processor 1.1 Ghz, 8 GB of memory and use of Yosemite 10.10.5. For the past 3 years, I have been using Laser ereaders (currently EB370) on this computer and my old lap top without problem. However, the
-
ICS via connection PPPOE Miniport Wan via Microsoft Virtual WiFi miniport card
Windows 7 Ultimate 64 bit. Pavilion 1201tx g6. I recently changed my ISP and it me connected via Dial-Up (WAN Miniport PPPOE) connection. My current network configuration is shown below: Problem is that now I can not share my Internet to my Android.B