0

I'm stuck trying to display a high resolution png image (6000x3000) in a WebView. I have the picture in a String (here called mimeString) encoded in Base64, that I have extracted from a file. I then simply use:

webView.loadData(mimeString, "image/png", "base64");

It works fine when the image has a moderate resolution (under 1MP), but with higher quality pictures, you can see pixelization due to some kind of down sampling. I would like to be able to get the full details when I zoom in my WebView.

I'm sure the string in base64 corresponds to the full resolution picture because I've tested it on in my web browser and the resolution is perfect.

Here is the pic in full resolution: enter image description here

Here is what I get on my tablet: picture with resolution loss

As you can see it is very annoying because the picture has to be precise to the pixel! Moreover I have tried to display these pictures in other ways than WebView, but it is the only way I found to have a good zooming widget that doesn't explode with an OOM as soon as the quality of the pictures becomes to big.

Remi D
  • 501
  • 4
  • 17
  • Quite similar question with a good answer (create single tiles, and load an html with all these tiles into your `WebView`): http://stackoverflow.com/questions/4678331/how-to-tile-and-scroll-a-large-image-10000x10000-in-android – dst Aug 21 '13 at 15:16
  • This is interesting, but as I told you I have the picture in a String, encoded in Base64. Thus I cannot pre process the picture, and I would need to do it just before displaying. The operation of cutting it into chunks would be costly! – Remi D Aug 21 '13 at 15:30
  • How do you fetch your image? – dst Aug 21 '13 at 15:31
  • Okay, maybe I wasn't precise enough. The app gets the picture from an XML file that the user can download directly with my app. The app parses this xml file and gets the String containing the picture (encoded in base64). – Remi D Aug 21 '13 at 15:41
  • Can you influence the server side? If so, you could use plain html on the server, so that there is no parsing required (either serve directly to the `WebView` or to download the html file with the single images)... – dst Aug 21 '13 at 15:46
  • No I'm not responsible for the server side. Otherwise I would have come up with a simpler solution! I have to act as if the input to my app was this Base64 String! – Remi D Aug 21 '13 at 15:51

0 Answers0