I am trying to develop an app with a camera. I have already successfully saved the image in the SD card, but the image will be sent to a server, so I need the image to be of a smaller size. The size that I am getting right now is 2.3 MB. Is there a way that I could make the image smaller?
private PictureCallback mPicture = new PictureCallback()
{
public void onPictureTaken(byte[] data, Camera camera) {
File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);
if (pictureFile == null){
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
Log.d(TAG, "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d(TAG, "Error accessing file: " + e.getMessage());
}
camera.startPreview();
}
};