Definir a orientação da imagem usando ExifInterface
setRotation method
emCamera.Parameters
não funciona em todos os dispositivos. Alguém sugere mudar manualmenteEXIF
informações para resolver o problema. Você pode me dar um pequeno exemplo de como definirexif
informação comExifInterface
de tal forma a definir a orientação da imagem como retrato?
private int savePicture(byte[] data)
{
File pictureFile = getOutputMediaFile();
if (pictureFile == null)
return FILE_CREATION_ERROR;
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
return FILE_NOT_FOUND;
} catch (IOException e) {
return ACCESSING_FILE_ERROR;
}
return OKAY;
}
Eu tentei com isso:
try {
ExifInterface exifi = new ExifInterface(pictureFile.getAbsolutePath());
exifi.setAttribute(ExifInterface.TAG_ORIENTATION, String.valueOf(ExifInterface.ORIENTATION_ROTATE_90));
exifi.saveAttributes();
} catch (IOException e) {
Log.e(TAG, "Exif error");
}
mas nada muda quando visualizo as imagens da galeria do android.