I've created my own controller to take pictures with the android camera. My problem is that the output shows a smaller image than expected. I've checked the width and height of my bitmap like this:
int w = bmp.getWidth();
int h = bmp.getHeight();
This outputs w = 480
and h = 640
which I assume is the size in pixels. This is my method for taking the picture
public void takePicture() {
Log.i("Camera View: ", "Take Picture");
camera.takePicture(null, null, new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
if (null != callback) {
callback.onJpegPictureTaken(data, camera);
}
}
});
}
Where my Activity
subscribes to this event onJpegPictureTaken
@Override
public void onJpegPictureTaken(byte[] data, Camera camera) {
Intent i = new Intent(this, ImageEditing.class);
i.putExtra("image", data);
startActivity(i);
}
The purpose of this is to launch a new Activity
in order to edit the image, like zooming and dragging. This ImageEditing.class gets the picture like this:
flipped = flipByteArrayNintyDegress(getIntent().getExtras()
.getByteArray("image"));
Bitmap bmp = BitmapFactory.decodeByteArray(flipped, 0, flipped.length);
image = (ImageView) findViewById(R.id.imageView1);
image.setImageBitmap(bmp);
image.setOnTouchListener(this);
I first thought that my ImageView
had some restriction due to the height and width of the ImageView
, but that is not the case. Here is the layout XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="matrix"/>
</FrameLayout>
Here is the result when I capture the image
Does anybody know what's going on here? Why is the image being scaled?