3

I have pixel-art style images stored in res/drawable with their naturally small scale, but meant to be scaled up for display. However the default behaviour seems to be to blur the upscaled image to try and hide the pixels. How can that be disabled?

  1. This is from a screenshot of the phone. You can see the image is blurry compared to the text.

blurry image

  1. This is the desired scaled image with sharp pixels (please ignore the background)

desirable image

I see there is a similar question for the old Android framework, but I'm using Jetpack Compose.

1 Answer 1

2

There is now a a filterQuality parameter you can set to None in the Image composable to disable bilinear interpolation. This is since version 1.1.0-alpha01 of androidx.compose.ui:ui.

Example usage:

Image(
    bitmap = ImageBitmap.imageResource(id = imageId),
    contentDescription = null,
    filterQuality = FilterQuality.None
)

Workarounds for older versions are mentioned here.

Sign up to request clarification or add additional context in comments.

1 Comment

filterQuality parameter has been moved to the Painter parameter of the Image composable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.