The role of filter in the last parameter of createScaledBitmap on Android

Asked 2 years ago, Updated 2 years ago, 55 views

If you look at the definition of android.graphics.Bitmap.createScaledBitmap

public static Bitmap createScaledBitmap
  (Bitmap src, int dstWidth, int dstHeight, boolean filter)

There's a filter. What is the difference between true and false?

android scaling

2022-09-22 22:17

1 Answers

For example,

Bitmap.createScaledBitmap(
                    bitmap
                    ,bitmap.getWidth()*2
                    ,bitmap.getHeight()*2
                    ,true);

If there's a code like this, it's a source that doubles... The difference between true and false of the last parameter is

If it's false: It's doubled as it is now in Pixel form The image may look broken or blurred.

If true: Adjust the image pixel form now It helps the image look clear.

Caution) If you increase the image or use the true option, the image that is too large is out of memory There is a high possibility of an error, so please use it carefully.


2022-09-22 22:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.