Java BufferedImage Compress compressImage(BufferedImage originalImage, int type, int width, int height)

Here you can find the source of compressImage(BufferedImage originalImage, int type, int width, int height)

Description

compress Image

License

Open Source License

Declaration

private static BufferedImage compressImage(BufferedImage originalImage, int type, int width, int height) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.*;

import java.awt.image.BufferedImage;

public class Main {
    private static BufferedImage compressImage(BufferedImage originalImage, int type, int width, int height) {
        BufferedImage resizedImage = new BufferedImage(width, height, type);
        Graphics2D g = resizedImage.createGraphics();
        g.drawImage(originalImage, 0, 0, width, height, null);
        g.dispose();/* w w w  .  ja  v  a2 s .c  o m*/

        return resizedImage;
    }
}

Related

  1. compress(BufferedImage image, float quality)
  2. compress(BufferedImage image, String path)
  3. compression(BufferedImage src, int scale)
  4. compressPhoto(Image originImg, int newWidth, int newHeight)