In android, when we open a screenshot from the gallery. It blurs for 2 seconds and then automatically adjusts.
But when I use this screenshot image to set the image using the image path as :,
Image Path: /mnt/sdcard/ScreenCapture/SC20130219-124221.png
private void showImage(String imgPath) {
System.out.println("Image Path is: "+imgPath);
ImageView openImage=(ImageView)findViewById(R.id.img_fullScreen);
ExifInterface exifMedia = null;
try {
exifMedia = new ExifInterface(imgPath);
} catch (IOException e) {
e.printStackTrace();
}
String exifOrint = exifMedia.getAttribute(ExifInterface.TAG_ORIENTATION);
int exifOrientation = Integer.parseInt(exifOrint);
System.out.println("Orientation Tag is:"+exifOrientation);
BitmapFactory.Options mOptions=new BitmapFactory.Options();
mOptions.inSampleSize=2;
Bitmap imgBitmap = BitmapFactory.decodeFile(imgPath,mOptions);
imgBitmap = getResizedBitmapImage(imgBitmap, 200, 200, exifOrientation);
openImage.setImageBitmap(imgBitmap);
}
Another case: when getting a Bitmap from a URL:
URL url = new URL(urlTarget);
BitmapFactory.Options mOptions = new BitmapFactory.Options();
mOptions.inSampleSize=1;
Bitmap bmp = BitmapFactory.decodeStream(url
.openConnection().getInputStream(),null,mOptions);
Then the image will not be automatically adjusted. He comes BLURRED. THAT'S MY PROBLEM.
ONLY IN CASE OF A SCREEN.
thank
source
share