Can i get java code to convert the image into binary bits.

You need some code like:


import java.io.*;
import javax.imageio.ImageIO;

.............
.............

BufferedImage imageFile = (BufferedImage)image;

byte data[] = null;

ByteArrayOutputStream ba = new ByteArrayOutputStream();
ImageIO.write(imageFile,"jpeg",ba);
ba.flush();

data = ba.toByteArray();
ba.close();

Read the file into an Image, then use the PixelGrabber class to extract the pixels as an array of alpha/r/g/b ints.
This gives you the image data after it has been decoded from jpeg/tiff or whatever.

Read the file into an Image, then use the PixelGrabber class to extract the pixels as an array of alpha/r/g/b ints.
This gives you the image data after it has been decoded from jpeg/tiff or whatever.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.