我可以从图像的字节流中更改图像的对比度吗?我已经完成了复制图像的必要工作,并且需要将更改对比度部分添加到代码中。知道怎么做吗?或者甚至有可能吗?
package make.image.bw;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
public class MakeImageBWActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); // set screen view
String imageInSD = Environment.getExternalStorageDirectory().getAbsolutePath() +"/earthglobe.jpg";
RandomAccessFile file = null;
try {
file = new RandomAccessFile(imageInSD, "r");
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
File myFile = new File(Environment.getExternalStorageDirectory(), "latestearth.jpg");
byte[] buffer = new byte[1024];
try {
FileOutputStream out = new FileOutputStream(myFile);
while(file.read(buffer)!=-1){
out.write(buffer,0,1024);
}
out.close();
} catch (IOException e) {
e.printStackTrace();
}
Log.d("tag", "finished");
finish();
}
}
提前感谢您的宝贵建议。