Rectangle rec = new Rectangle(w,h); BufferedImage a = r.createScreenCapture(rec); //Serialize ByteArrayOutputStream bos = new ByteArrayOutputStream();; try { ObjectOutput o = new ObjectOutputStream(bos) ; o.writeObject((Object) a); o.close(); } catch (IOException e) {} byte[] serial = bos.toByteArray(); try{ out.writeObject(serial.length); for(int i = 0; i < serial.length; i++) out.writeObject(serial[i]); out.writeObject("picture sent"); }catch(IOException e){}ption e){}