| Reply | « Previous Thread | Next Thread » |
|
Hello
How can I get a byte[] from an image() ? Thanx |
|
.....without using nokia API
|
|
In MIDP 1.0 it's impossible.
shmoove |
|
thanx, but with MIDP 2.0 ?
|
|
Image.getRGB().
shmoove |
|
I use JpegEncoder to get byte [] array (not a raw!), and to store Image in galery:
//---------------------JpegEncoder---------------------------- http://ce.sharif.edu/~p_amini/j2me/J...egEncoder.java //--------------------get byte []----------------------------- ........... ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); JpegEncoder je = new JpegEncoder (tempImage,quality,byteArrayOutputStream); byte[] ByteArray = byteArrayOutputStream.toByteArray(); //this is not a raw array. It is possible to create image! ....... //------------------------store-------------------------------- ......... FileConnection fc=null; try { String fn = ""+System.getProperty("fileconn.dir.photos")+"file.jpg"; fc = (FileConnection ) Connector.open(fn); fc.create(); OutputStream os = fc.openDataOutputStream(); JpegEncoder je = new JpegEncoder(tempImage,quality,os); os.flush(); os.close(); fc.close(); System.out.println("File writing OK"); }catch(IOException ex) { System.out.println("File writing error: "+ex.getMessage()); } .........
Last edited by hclubmk : 2008-08-13 at 13:12.
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|