투케이2K

389. (android/java) Bitmap 비트맵 생성 filter true 사용해 픽셀 (pixel) 해상도 조절 실시 - 선명, 흐림, 깨짐 표시 본문

Android

389. (android/java) Bitmap 비트맵 생성 filter true 사용해 픽셀 (pixel) 해상도 조절 실시 - 선명, 흐림, 깨짐 표시

투케이2K 2022. 11. 4. 16:01
반응형

[개발 환경 설정]

개발 툴 : AndroidStudio

 

[소스 코드]

		// ==========================================

		// [로직 처리 실시]
		try {

			// [비트맵 이미지 생성]
			Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.apple_icon);

			// [이미지 픽셀 해상도 재설정]
			int width=(int)(150);
			int height=(int)(150);

			// [조절된 픽셀 해상도로 다시 비트맵 생성 : filter true = pixel 형태를 조정]
			Bitmap resizedBitmap = Bitmap.createScaledBitmap(bmp, width, height, true);
			imageView.setImageBitmap(resizedBitmap); // 이미지뷰에 조정한 이미지 넣기
		}
		catch (Exception e){
			e.printStackTrace();
		}

		// ==========================================
 

[결과 출력]


 

반응형
Comments