서버에 이미지를 올리는데 용량을 줄이기 위해 bitmap에서 decodeFile을 이용해서 용량을 줄이긴 했는데 이 이미지를 서버로 올리려고 io.file로 바꾸려고 하는데 어떻게 해야할지를 모르겠습니다.
일단 구글링을 해보는데까지 해서 io.file로 전환 후 전송은 했는데 자세한 설명이 안되어있어 원리를 이해하기 힘들었고 중요한건 원본 사진의 메타데이터가 손상되어서 적용시키기 힘들게 됐습니다.
//이미지 용량 줄이기
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
Bitmap orgImage = BitmapFactory.decodeFile(path, options);
File file = new File(path);//원본 이미지의 경로가 들어있습니다.
try {
OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
orgImage.compress(Bitmap.CompressFormat.JPEG, 100, os);
os.close();
}catch(IOException e){
e.printStackTrace();
}
이미지 용량을 줄이는 코드와 io.file로 바꾸는 코드는 위와 같이 작성했는데 어떻게 수정해야 하나요?