sdcard에 웹에서 받아온 대용량 .png이미지가 있을 경우에 BitmapRegionDecoder를 이용하여

 

BitmapRegionDecoder imgDecoder = BitmapRegionDecoder.newInstance(sdUrl, false);

 

Bitmap bmp = imgDecoder.decoderRegion(new Rect(0, 0, imgWidth, imgHeight/2), null);

Bitmap bmp2 = imgDecoder.decoderRegion(new Rect(0, imgHeight/2, imgWidth, imgHeight), null);

 

와 같은 소스코드로 이미지를 나누어서 읽어와서 사용하였습니다.

 

이때 웹에서 받아온 이미지가 .jpg인 경우에는 위의 소스에서

"Image failed to decode using JPEG decoder"라는 디코딩 실패 메세지가 출력이 됩니다.

이미지가 .jpg인 경우에 bmp, bmp2를 위와 같은 결과로 얻을 려면 어떻게 해야 할까요...?