盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

ZT 上传图片的缩放处理

时间:2024/12/20作者:未知来源:盾怪网教程人气:

[摘要](Bi.getWidth()>120))if (Bi.getHeight()>Bi.getWidth())Ratio = 120.0/Bi.getHeight();elseRatio =...
(Bi.getWidth()>120)){
if (Bi.getHeight()>Bi.getWidth())
Ratio = 120.0/Bi.getHeight();
else
Ratio = 120.0/Bi.getWidth();
}


AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(Ratio, Ratio), null);
Itemp = op.filter(Bi, null);

try {
ImageIO.write((BufferedImage)Itemp, ext, ThF);
}catch (Exception ex) {
throw new Exception(" ImageIo.write error in CreatThum.: "+ex.getMessage());
}
return (true);
}
}






该程序由于使用到Java 的AWT,虽然没有显示,但是在linux系统下,程序需要X11 windows的支持.需要安装 XFree86
或XFree86-Xvfb ,加入 export DISPLAY=hostdomain:0.0

为这个问题,我也头疼半天,查询网上类似我这样抱怨很多,既然Java是一次编写,到处运行,好象有点名不副实.

当然也可以使用PJA VNC 或ACME Laboratories 但由于该程序使用到jdk1.4最新的类,估计其他替代产品没有出来,只好作罢.


关键词:ZT 上传图片的缩放处理




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版