I want to compress the image taken from a camera to png format to make them smaller in size, so I'm using this code:
compressedPictureFile = new File(imagePath);
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
FileOutputStream fOut = new FileOutputStream(compressedPictureFile);
boolean compressed = bitmap.compress(Bitmap.CompressFormat.PNG, 0, fOut);
fOut.flush();
fOut.close();
The problem is that compressedPictureFile is actually bigger that the original image (from 1 Mb to 6Mb)
What am I missing? And is this the best way to reduce the size of an image?
Thanks