I wrote a method to change Bitmap from camera shot :
public Bitmap bitmapChange(Bitmap bm) {
/* get original image size */
int w = bm.getWidth();
int h = bm.getHeight();
/* check the image's orientation */
float scale = w / h;
if(scale < 1) {
/* if the orientation is portrait then scaled and show on the screen*/
float scaleWidth = (float) 90 / (float) w;
float scaleHeight = (float) 130 / (float) h;
Matrix mtx = new Matrix();
mtx.postScale(scaleWidth, scaleHeight);
Bitmap rotatedBMP = Bitmap.createBitmap(bm, 0, 0, w, h, mtx, true);
return rotatedBMP;
} else {
/* if the orientation is landscape then rotate 90 */
float scaleWidth = (float) 130 / (float) w;
float scaleHeight = (float) 90 / (float) h;
Matrix mtx = new Matrix();
mtx.postScale(scaleWidth, scaleHeight);
mtx.postRotate(90);
Bitmap rotatedBMP = Bitmap.createBitmap(bm, 0, 0, w, h, mtx, true);
return rotatedBMP;
}
}
It works fine in another Android device, even Galaxy Nexus but in Samsung Galaxy S3, the scaled image doesn’t show on screen.
I tried to mark the bitmapChange method , let it show the original size Bitmap on screen but S3 also show nothing on screen.
The information of variables in eclipse is here.
The information of sony xperia is here.
xperia and other device is working fine.
Edit:
I got some Strange log in LogCat,
when i take a picture the LogCat show some message:
I never use video…
why video is started??
I searched around and it seems there might be two possible reasons:
1) S3 has memory problems. Check out this SO Question The S3 gives problems even when scaling images!
Solution- The solution is to make the bitmap conversion more memory-friendly as shown here and discussed in this SO question
2) Samsung phones set the EXIF orientation tag, rather than rotating individual pixels
Solution- Take a look at this SO question