imgscalr-lib-4.2.jar



package kr.common.util;


import java.awt.image.BufferedImage;

import java.io.ByteArrayOutputStream;

import java.io.File;

import java.io.IOException;


import javax.imageio.ImageIO;


import org.imgscalr.Scalr;

import org.imgscalr.Scalr.Method;

import org.imgscalr.Scalr.Mode;


public class ThumbnailExample {


public static void main(String[] args) throws IOException {


long startTime = System.currentTimeMillis();

File f = new File("D:\\111.jpg");

BufferedImage img = ImageIO.read(f); // load image


BufferedImage thumbImg = Scalr.resize(img, Method.QUALITY, Mode.AUTOMATIC, 50, 50, Scalr.OP_ANTIALIAS);

//convert bufferedImage to outpurstream 

ByteArrayOutputStream os = new ByteArrayOutputStream();

ImageIO.write(thumbImg, "jpg", os);


//or wrtite to a file


File f2 = new File("D:\\111_thumb.jpg");


ImageIO.write(thumbImg, "jpg", f2);


System.out.println("time is : " + (System.currentTimeMillis() - startTime));


}


}




문제가 있음..




Posted by [czar]
,