Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color distorted for RGB_565 bitmaps with renderscript blur algorithms #19

Open
diegor2 opened this issue Jun 12, 2020 · 3 comments
Open

Comments

@diegor2
Copy link

diegor2 commented Jun 12, 2020

I need to copy to a new bitmap using ARGB_8888 config to get the correct image, otherwise the colors get really trippy

@diegor2
Copy link
Author

diegor2 commented Jun 12, 2020

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        GlobalScope.launch(Dispatchers.IO) {
            val url = "https://upload.wikimedia.org/wikipedia/commons/a/ad/Gretag-Macbeth_ColorChecker.jpg"
            val stream = URL(url).openStream()
            val bitmap = BitmapFactory.decodeStream(stream)
                .copy(Bitmap.Config.RGB_565, false)

            Dali.create(this@MainActivity)
                .load(bitmap)
                .skipCache()
                .blurRadius(12)
                .into(image);
        }
    }
}

Screenshot_20200612-232809

@patrickfav
Copy link
Owner

patrickfav commented Jun 13, 2020

Hmm, if you use the default config, this lib just uses the built-in renderscript blur algo. I think I never tested with 565, but I guess there is no easy fix for this - aka I believe this is a Renderscript bug.

@patrickfav
Copy link
Owner

Relates to #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants