image is successfully recieved at the server side and i can display it on label but my Problem is how to save that image i used
JFileChooser.showSaveDialog()
i tried printstream i can save the file but whenever i opened the file in image viewer it is showing as this type of file is cant be opened
Plz help me with this guys
BufferedImage img=ImageIO.read(ImageIO.createImageInputStream(sock.getInputStream()));
System.out.println("Image received!!!!");
JFileChooser fc = new JFileChooser();
int i=fc.showSaveDialog(null);
if( i == JFileChooser.APPROVE_OPTION ) {
PrintStream ps = new PrintStream(fc.getSelectedFile());
// ImageIO.write(bimg,"JPG",fc.getInputStream());
ps.print( img);
ps.close();
lblNewLabel.setIcon(new ImageIcon(img)); //image is successfully displaying on the label
}
Aucun commentaire:
Enregistrer un commentaire