Skip to main content

Converting Image to byte array[] ?

2 replies [Last post]
Joined: 2009-04-06
Points: 0

Hi everyone,

I'm trying to send an image stored in midlet to a servlet through http. However to do this, the midlet has this method that retrieves an Image type. I need to convert from Image to a byte array[] or something that can be sent through a DataOutputStream, any ideas?

 DataOutputStream dos = conn.openDataOutputStream();</p>
<p> Image ima = data.getImg();</p>
<p>        dos.writeUTF(data.getName());<br />
        dos.writeUTF(data.getTel());<br />

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2013-04-18
Points: 0

here is image to byte array code. tutorial on the web.
Imports System.IO
Imports System.Drawing.Printing
Imports RasterEdge.Imaging
Imports RasterEdge.Imaging.Processing
Imports RasterEdge.Imaging.Converting.ImageToByte

Dim Image As New RasterEdgeImaging()
If True Then
Dim image As New MemoryStream()
ImageID.Save(image, System.Drawing.Imaging.ImageFormat.Jpeg)
Return ms.ToArray()
End If

Joined: 2003-06-15
Points: 0

Search for getRBG() method.
The rest should be obvious.