import java.io.*; //将bmp格式的图片反色 public class Tupianchuli { public static void main(String args[]) throws Exception { File f=new File("图片源绝对路径.bmp"); File fa=new File("图片输出的绝对路径.bmp"); FileInputStream s=new FileInputStream(f); FileOutputStream sa=new FileOutputStream(fa); byte [] b=new byte[(int)f.length()]; s.read(b); for(int i=0;i<f.length();i++) { if(i>54) b[i]=(byte)((byte)0xff-b[i]); } sa.write(b); sa.close(); s.close(); } } //源代码片段来自云代码http://yuncode.net