2
我想採用Android 機攝像頭到SD卡旋轉和保存我捕獲的圖像。由於本機攝像機默認爲風景。但我不想使用位圖。是否有可能這樣做?請幫忙。我是android開發新手。旋轉和保存拍攝的圖像,而無需使用位圖
當我的圖像旋轉90度時,我需要在保存前使用位圖將其旋轉。 但在某些設備上bmp即將到來null。
相機活動佈局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</RelativeLayout>
manifest資源配置文件
<activity
android:name="com.example.androiddms.CameraActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/title_activity_camera"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
相機Activity.java
FileOutputStream fos = new FileOutputStream(pictureFile);
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Matrix matrix = new Matrix();
matrix.postRotate(90);
bmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
bmp.compress(Bitmap.CompressFormat.JPEG, 100,fos);
你用位圖面臨什麼問題? –
位圖使用了很多內存。儘管存在一些技術來處理它們。但我只是想嘗試如果我可以保存**捕獲的圖像**,而不使用**位圖**。 – ZZeyaNN