//获取旗帜
File flag_file=new File("五星红旗.jpg");
BufferedImage flag_image=ImageIO.read(flag_file);
//获取头像
File head_file=new File("1.jpg");
BufferedImage head_image=ImageIO.read(head_file);
//求旗帜和头像最小长宽
int w1=flag_image.getWidth();
int h1=flag_image.getHeight();
int w2=head_image.getWidth();
int h2=head_image.getHeight();
int w=w1>16; //R
rgbs[1]=(rgb&0xff00)>>8; //G
rgbs[2]=rgb&0xff; //B
int alpha=(int)(255*(1-((float)i/(float)w))); //透明度
Color c=new Color(rgbs[0],rgbs[1],rgbs[2],alpha);
g.setColor(c);
g.drawLine(i,j,i,j);
}
}
//输出图像
OutputStream out=new FileOutputStream(new_file);
ImageIO.write(new_image, "jpg", out);
输入:五星红旗.jpg,1.jpg
输出:out.jpg



