0
画像の縮小には少し問題があります。大きな解像度の携帯電話では、すべての画像が正常に表示されますが、小さい携帯電話で画像を縮小する必要がある場合、画像は滑らかに見えません。たぶん誰かが私を助けることができます。前もって感謝します。ここではいくつかの画面が注4およびS2の携帯電話からの撮影です。画質を上げる方法
Note 4 Screen Shoot, upscale from 3840x2160 to 4551x2560
S2 Screen Shoot, downscale from 3840x2160 to 1422x800
Bitmap bitmap;
public void setWallpaper() {
Bitmap bitmap = BitmapFactory.decodeStream(getResources().openRawResource(R.raw.img_test));
float screenWidth, screenHeight;
float bitmap_width = bitmap.getWidth(), bitmap_height = bitmap.getHeight();
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
screenWidth = display.getWidth();
screenHeight = display.getHeight();
float bitmap_ratio = bitmap_width/bitmap_height;
float screen_ratio = screenWidth/screenHeight;
int bitmapNewWidth, bitmapNewHeight;
if (screen_ratio > bitmap_ratio) {
bitmapNewWidth = (int) screenWidth;
bitmapNewHeight = (int) (bitmapNewWidth/bitmap_ratio);
} else {
bitmapNewHeight = (int) screenHeight;
bitmapNewWidth = (int) (bitmapNewHeight * bitmap_ratio);
}
bitmap = Bitmap.createScaledBitmap(bitmap, bitmapNewWidth, bitmapNewHeight, true);
try {
WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext());
myWallpaperManager.setBitmap(bitmap);
Toast.makeText(getApplicationContext(), "Set wallpaper successfully!", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}
あなたのイメージをスケーリングするために、次を使用して、私はすでに、残念ながらこれを試してみましたが、していますアンチエイリアシングなしのように、イメージは同じように見えます。 –