0
The problem is this, I take the picture and if it in Activity, so far so good, but after converting it and sending to the server and decoding, only appears part of the photo:
Code to take the photo
private Integer ImageHeight = 520;
private Integer ImageWidth = 520;
// Cria o caminho do arquivo no sdcard
file = SDCardUtils.getPrivateFile(getBaseContext(), simpleDateFormat.format(new Date())+".jpg", Environment.DIRECTORY_PICTURES);
// Chama a intent informando o arquivo para salvar a foto
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(i, 0);
Bitmap bitmap = ImageResizeUtils.getResizedImage(Uri.fromFile(file), ImageWidth, ImageHeight, true);
Foto = Utils.ConvertPhotoBase64(bitmap);
Conversion code to Base64
public static String ConvertPhotoBase64(Bitmap bmp) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 50, baos);
byte[] data = baos.toByteArray();
Log.i("FOTO64", Base64.encodeToString(data, Base64.DEFAULT));
return Base64.encodeToString(data, Base64.DEFAULT);
}
Thank you.
Will the problem is not in this resize 520x520?
– Leonardo Dias
Brother I have changed this to several sizes, and always the same thing, sometimes increases and decreases the size of the strokes after decoded. Another remark, when taking picture of a black part, at the time of converting error "Application stopped"
– Rubens Ventura
You have already tried for a different Thread, because android does not work in the same thread the image conversion, as well as access to WS. Have a look: http://stackoverflow.com/a/10594695/6405917
– Gustavo Tinoco