List of utility methods to do BufferedImage Save
boolean | saveImage(BufferedImage image) save Image if (image == null) return false; JFileChooser fC = new JFileChooser(); File file; if (JFileChooser.APPROVE_OPTION == fC.showSaveDialog(null)) { file = fC.getSelectedFile(); return saveImage(image, file); return false; |
void | saveImage(BufferedImage img, String extension) Asks the user for a file and then saves the image to that file. JFileChooser fc = new JFileChooser("."); int action = fc.showSaveDialog(null); if (action == JFileChooser.APPROVE_OPTION && fc.getSelectedFile() != null) { File f = fc.getSelectedFile(); if (f.getPath().toLowerCase().endsWith("." + extension.toLowerCase()) == false) { f = new File(f.getPath() + "." + extension); if (f.exists()) { ... |
void | saveImage(BufferedImage img, String targetfile) save Image String image_format = "png"; FileOutputStream out = new FileOutputStream(targetfile); javax.imageio.ImageIO.write(img, image_format, out); out.close(); |
void | SaveImageToFile(BufferedImage bimg, String filename, String outformat) Save Image To File File f = new File(filename); if (outformat.equalsIgnoreCase("JPEG") || outformat.equalsIgnoreCase("JPG")) SaveJPEG(bimg, f); else SaveImageToFile(bimg, f, outformat); |