Java tutorial
import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; public class Main { public static void main(String[] args) throws IOException { byte[] picture = new byte[2048]; // your image data InputStream in = new ByteArrayInputStream(picture); BufferedImage buf = ImageIO.read(in); ColorModel model = buf.getColorModel(); int height = buf.getHeight(); int width = buf.getWidth(); } }