2012-08-23 4 views
1

사용자 정의 카메라 응용 프로그램을 만들었으며 카메라를 클릭 한 후 이미지 뷰에 내 이미지를 표시하고 있습니다. 하지만 여기서 나는 항상 내가 변화된 방향으로 설정된 이미지를 찍는 문제에 직면하고있다.비트 맵 오리엔테이션 변경

인물 사진을 인물 사진으로 찍을 때 사진을 촬영하는 경우 인물 사진으로 설정하지 않으면 방향이 변경됩니다. 여기

카메라를 클릭 코드 : -

그것은 항상 각 장치에 대해 동일한 구현되지 않은 것
@Override 
     public void onPictureTaken(byte[] data, Camera camera) { 

      //here we write the code for saving the picture onto the sdCard 


      File pictureFileDir = getDir(); 

      //to check whether directory exists or not!! 
      if (!pictureFileDir.exists() && !pictureFileDir.mkdirs()) { 

       //Log.d(Constants.DEBUG_TAG, "Can't create directory to save image."); 
       Toast.makeText(Irant_Custom_cameraApplication.this, "Can't create directory to save image.", 
         Toast.LENGTH_LONG).show(); 
       return; 

      } 

      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyymmddhhmmss"); 
      String date = dateFormat.format(new Date()); 
      photo_file="Picture_"+date+".jpg"; 

      photo_FileName = pictureFileDir.getPath()+File.separator+photo_file; 

      picture_file = new File(photo_FileName); 

      FileOutputStream outStream = null; 
      try{ 
       Toast.makeText(getApplicationContext(), "Image captured!", Toast.LENGTH_LONG).show(); 
       outStream = new FileOutputStream(picture_file); 
       outStream.write(data); 
       outStream.close(); 

       String imgpath = photo_file; 
       System.out.println("Path for the image*********************"+photo_file); 
       SignupDetails.imagePath=imgpath; 

      } 


      catch (Exception e) { 

       Log.d("Image save error :", e.getMessage());  
      } 
     } 
    }; 

답변

0

, 일부는 다른 사람들이하지 않는, 자동으로 회전. 가장 좋은 방법은 파일의 EXIF 데이터를 보는 것입니다. 그게 최선의 방법입니다.

관련 문제