I am writing a function, which takes a bitmap, edits it and saves it. But the problem is that the saved image is not having the same dimensions. Can anyone help me fix it? I want the output image to be of same length and width as that of the original image.
This is my code -
public void bitTest(View v) throws IOException {
Drawable t=getResources().getDrawable(R.drawable.slider_touch,getTheme());//the image to be processed
Bitmap bit=((BitmapDrawable) t).getBitmap();//its bitmap
Bitmap finalImage=Bitmap.createBitmap(bit.getWidth(),bit.getHeight(),bit.getConfig());//creating another bitmap of same dimensions
Context context=getApplicationContext();
FileOutputStream fos = context.openFileOutput("test.png", Context.MODE_PRIVATE);//saving
finalImage.compress(Bitmap.CompressFormat.PNG,100, fos);
fos.close();
}
Here the original size is having dimensions of 288x192 but the output image has dimensions of 605x403. Where am i wrong?
Also i have tried changing the quality, but it doesn't works.