-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Loaded bitmap is "pixelated" #23
Comments
It seems that I will have to raise another bug with Google but it may not be fixed for years. If you can convert the image to another format, that's your best option. I have tried changing all the options for the |
Thanks @davemorrissey , I made some research and it looks like it's a bug in skia library, which is used natively by BitmapRegionDecoder. I wonder if you know: is it possible to convert image programmatically on the phone to display it properly? |
That's a good find, the skia library didn't come up in my research. If you've found reports of this bug could you send me a link? It is possible to convert the image by loading it as a bitmap (it appears other Android classes are unaffected), and saving it again. This is slow. However, I don't know how you can tell if the image is grayscale before doing this, and |
Sadly, I didn't find the report itself, only some mentions of it. I suspect this: ^ this looks like a fixed source and this (https://github.com/android/platform_external_skia/blob/80bacfeb4bda06541e8695bd502229727bccfeab/src/images/SkImageDecoder_libpng.cpp) is bugged. Note that I bad at computer graphics, so this might be the wrong track, BUT I had similar issue (pixelated image) with this image: http://hc.readmanga.ru/gto_shonan_14_days/v1ch1/02.jpg_res.jpg that is not a grayscale image but has a lot of red color in it and in the same time, in the comments of libpng there is a mention of red being > 255. This is that comment: /* We apply the mask because in a very small |
This is beyond my experience! Are you sure this libpng class is used for JPEGs as well? So far I've had no reported problems with PNGs, only JPEGs. |
Closing issue as wontfix because it's a flaw in Android I can't work around. |
I fixed this using https://github.com/suckgamony/RapidDecoder |
Thanks, that looks like a good solution. If you have time, could you post a couple of notes and a code sample showing how you use this library with SubsamplingScaleImageView, so I can post it on the readme? |
Hmm, okay. I did something like this:
and added a "_source" field to the SubsamplingScaleImageView class. |
I assume the _source field is a string? Because this doesn't use the sample size it will create tiles that are higher resolution than they should be. The |
Yes, I know that. I just didn't have enough time yet, to rewrite it. |
I suppose, I need to call scale method there, as the RapidDecoder 'documentation' states that "All of the scaling operations automatically decode bounds of bitmaps and calculate inSampleSize, so you don't need to consider about them at all.". Still, I don't know how to set RGB_565 option. |
Okay, I found how to set RGB_565. It's just calling "config" method with RGB_565 as a parameter. |
I have extracted the bitmap decoding into an interface to allow an alternative decoder to be easily substituted in. A basic implementation built on RapidDecoder is included in the sample library, and it displays this image properly. See the updated README for more details. |
Some images are loading in very poor quality. It's always the same images, but I can't figure out what they have in common. Here is the example of image and a screenshot how it looks like on a device. (btw, I use subsampling view). The issue persists on every device I tried and also on genymotion emulator, so I think it's a bug
![sun-ken-rock-v01-c03---20](https://cloud.githubusercontent.com/assets/4058545/4541937/73006988-4e1b-11e4-9d19-e21307bdb243.jpg)
![image](https://cloud.githubusercontent.com/assets/4058545/4541978/3728f906-4e1c-11e4-831d-cca55e43c0ef.png)
The text was updated successfully, but these errors were encountered: