上传图片时可以自由剪切吗?

小弟最近想实现这样一个功能:比如说,上传了一个600*500的长方形图片,而规定的图片是正方形,尺寸为300*300。现在要实现的是如果剪切600*500的这张图片,将想要剪切的部分保存为300*300,如果可以自由缩放图片就更好了。就类拟QQ那种。

                                                                                       在这里先谢过各位大侠了~

JavaScript 图片切割(裁剪、剪切)效果 http://bbs.blueidea.com/viewthread.php?tid=2900687
http://www.cnblogs.com/cloudgamer/archive/2008/07/21/1247267.html

[code="java"]
public static boolean makeThumb(String path,String endname){
boolean b = true;
try
{
File file = new File(path+"/avatar/"+endname);
String newurl=path+"/thumb/"+endname; //�µ�����ͼ�����ַ
Image src = ImageIO.read(file); //����Image����
int new_w=50;
int new_h=50;
BufferedImage tag = new BufferedImage(new_w,new_h,BufferedImage.TYPE_INT_RGB);
tag.getGraphics().drawImage(src,0,0,new_w,new_h,null); //������С���ͼ
FileOutputStream newimage=new FileOutputStream(newurl); //������
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(newimage);
encoder.encode(tag); //��JPEG����
newimage.close();

        }catch (Exception e){

        e.printStackTrace();
        b=false;
}

   return b;    

}
[/code]

我把我用的后台制成缩略图源代码贴出来,你自己去查相关类的API,这个是绝对可以跑的,这段代码的主要作用是根据用户上传的图片后台动态生成一张50*50的缩略图。