请教各位高人有关用java.awt克隆图片的实现
请教各位高人一下,小妹之前用ij.ImagePlus处理图像,现在要改用java.awt.Image软件包对图像进行处理,想请问一下,
img.setProcessor("",img.getProcessor().resize(newWidth,newHeight));
这个命令img为ImagePlus类,但如果img改用Image类,怎样能实现呢?不胜感激!!!
用在以下要重新设定图像的尺寸。
package Tranformation;
import java.awt.Image;
/*resize*/
public class resizeImage{
public void resize(Image img, int longMax)
{
if(img==null || img.getWidth(null)<longMax || img.getHeight(null)<longMax || longMax<0)
return;
int width = img.getWidth(null);
int height = img.getHeight(null);
int newWidth;
int newHeight;
int k=1;
do
{
newWidth = (int)(width/k);
newHeight = (int)(height/k);
k++;
}while(newWidth>longMax || newHeight>longMax);
//如何用java.awt实现以下保存设置图像的大小
//img.setProcessor("",img.getProcessor().resize(newWidth,newHeight));
}
}