File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes Converting image to byte array in j2me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Converting image to byte array in j2me" Watch "Converting image to byte array in j2me" New topic

Converting image to byte array in j2me

Ullas Vadakke

Joined: May 19, 2006
Posts: 1
Hi friends
I am doing a project which requires to convert my images in png format to byte array and then pass it to the server in java . Could any anyone help me???
Are there any classes which helps to do this??
Thanking all in advance
satyam gupt

Joined: Feb 13, 2004
Posts: 8
put image in resource folder and use input streamreader to get byte array
Punit Raizada
Ranch Hand

Joined: Mar 20, 2004
Posts: 156
If you have MIDP 2.0 devices then you could you Image objects getPixels() method to get the pixel data. The server would then add the header info etc.

SCJP 1.4
Everything that can go wrong will go wrong -Murphy
It is sorta covered in the JavaRanch Style Guide.
subject: Converting image to byte array in j2me
It's not a secret anymore!