kaydetmeden önce. Ben resim çekildikten sonra ne yapıyoruz: İstiyorum NeAndroid Döndür Resim Sadece benim kamera aktivitesini bitmiş ve harika verileri kurtarıyor
protected void savePictureData() {
try {
FileOutputStream fs = new FileOutputStream(this.photo);
fs.write(this.lastCamData);
fs.close(); //okay, wonderful! file is just written to the sdcard
//---------------------
//---------------------
//TODO in here: dont save just the file but ROTATE the image and then save it!
//---------------------
//---------------------
Intent data = new Intent(); //just a simple intent returning some data...
data.putExtra("picture_name", this.fname);
data.putExtra("byte_data", this.lastCamData);
this.setResult(SAVED_TOOK_PICTURE, data);
this.finish();
} catch (IOException e) {
e.printStackTrace();
this.IOError();
}
}
Yukarıdaki kodda verilen yorum olarak zaten. Görüntünün sadece dosyaya kaydedilmesini değil, döndürülmesini ve kaydedilmesini istemiyorum! Teşekkürler!
// DÜZENLEME: Ben kadar şu anda duyuyorum Ne
byte[] pictureBytes;
Bitmap thePicture = BitmapFactory.decodeByteArray(this.lastCamData, 0, this.lastCamData.length);
Matrix m = new Matrix();
m.postRotate(90);
thePicture = Bitmap.createBitmap(thePicture, 0, 0, thePicture.getWidth(), thePicture.getHeight(), m, true);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thePicture.compress(CompressFormat.JPEG, 100, bos);
pictureBytes = bos.toByteArray();
FileOutputStream fs = new FileOutputStream(this.photo);
fs.write(pictureBytes);
fs.close();
Intent data = new Intent();
data.putExtra("picture_name", this.fname);
data.putExtra("byte_data", pictureBytes);
this.setResult(SAVED_TOOK_PICTURE, data);
this.finish();
olası yinelenen [Android: bir merkez noktası üzerinde bir bit eşlem döndürmek için nasıl] (http://stackoverflow.com/questions/4166917/android-how-to-rotate-a-bitmap-on-a -Center noktalı) – slayton
nah, pek değil, onun döndürmek ve daha sonra – androidavid
benim çözüm işe görünüyor iyi misin kaydetmek konusunda daha fazla - projeyi temizlenir ... – androidavid