2011-09-05 5 views

답변

1

이 질문은 조금 오래된,하지만 헤이 ...

당신은 다음 코드를 사용하여이 문제를 해결 얻을 수 있습니다. 그러나 이미지를 매우 작게 만든 다음 매우 큰 이미지에 맞춰 이미지를 늘리면 품질이 떨어집니다. 즉, 이미지가 너무 크면로드 할 수 없으며 배경 무늬로 사용하기를 원할 것입니다. 다음과 같이하면 좋을 것입니다.

  // use if resizing the image 
      BitmapFactory.Options options = new BitmapFactory.Options(); 

      // set to true to set image bounds 
      options.inJustDecodeBounds = true; 

      // set to 2, 4, 6, etc to create a progressively smaller image 
      options.inSampleSize = 2; 

      // set to false to prepare image for decoding 
      options.inJustDecodeBounds = false; 

      bitmap = BitmapFactory.decodeStream(is, null, options); 
+0

샘플 크기는 항상 2의 제곱이어야합니다. IE 2,4,8,16. http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inSampleSize –

관련 문제