我现在可以按我的要求将图片缩小及转换格式了,可出来的颜色变化大了,越鲜艳的图片越明显。比如我先再传上去一张240x320的图,大小是120k。我现在不缩小它,设置还是要缩成240x320的图,他出来的就变成20多k大小了,图片颜色就有一定的变化了,这东西谁研究过他。这是我的代码    
public void changeDimension(String source, String desc, String fileName,
int width, int height) throws JimiException, IOException {
String temp = desc;
File _file = null;
double x = 0.0;
double y = 0.0;
if (desc == null || desc.trim().equals(""))
desc = source; if (!desc.toLowerCase().trim().endsWith("jpg")) {
temp = desc.trim() + ".jpg"; }
String path = desc.substring(desc.lastIndexOf("up") - 1, desc.length());
//this.toJPG(source, fileName, 74);
//this.toGIF(source, fileName);
_file = new File(source); // �����ļ�
Image src = javax.imageio.ImageIO.read(_file); // ����Image����
double oldwideth = (double) src.getWidth(null); // �õ�Դͼ��
double oldheight = (double) src.getHeight(null); // �õ�Դͼ��
if (oldwideth < oldheight) {
double xx = width / oldwideth;
x = oldwideth * xx;
y = oldheight * xx;
} else if (oldwideth >= oldheight) {
double yy = height / oldheight;
x = oldwideth * yy;
y = oldheight * yy;
} BufferedImage tag = null;
try {
tag = new BufferedImage((int) x, (int) y,
BufferedImage.TYPE_INT_RGB);
tag.getGraphics().drawImage(src, 0, 0, (int) x, (int) y, null);

//tag.getGraphics().drawImage(src.getScaledInstance((int) x, (int) y,  Image.SCALE_SMOOTH), 0, 0,  null);   

 FileOutputStream newimage = new FileOutputStream(desc); // 输出到文件流
   JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(newimage);
   encoder.encode(tag); 
   newimage.close(); } catch (Exception e) {
e.printStackTrace();
}
}