Java BigDecimal Encode encodeImage(BufferedImage bufferedImage, File file)

Here you can find the source of encodeImage(BufferedImage bufferedImage, File file)

Description

encodes as a .jpg a given BufferedImage

License

Open Source License

Parameter

Parameter Description
bufferedImage the Buffered Image to be encoded
file the File to write to

Declaration

public static void encodeImage(BufferedImage bufferedImage, File file) 

Method Source Code

//package com.java2s;
import javax.imageio.*;
import javax.swing.*;

import java.awt.image.BufferedImage;
import java.io.*;

public class Main {
    /**//from w  ww .jav  a  2  s  . c o  m
     * encodes as a .jpg a given BufferedImage
     * @param bufferedImage the Buffered Image to be encoded
     * @param file the File to write to
     */
    public static void encodeImage(BufferedImage bufferedImage, File file) {

        try {
            // Save as JPEG
            ImageIO.write(bufferedImage, "jpg", file);
        } catch (IOException e) {
            JOptionPane.showMessageDialog(null,
                    "Sorry, an error has occured : " + e);
        }
        // Create a buffered image in which to draw

    }
}

Related

  1. encodePackedBCD(BigDecimal v, int decimals, int length)
  2. encodeRealNumberRange(BigDecimal number, int maxNumDigits, BigDecimal offsetValue)
  3. encodeRealNumberRange(BigDecimal number, int maxNumDigits, BigDecimal offsetValue)