Android: pixel quality reduction in Images loaded in WebView -
Android: pixel quality reduction in Images loaded in WebView -
i building javascript application mobile browsers (not wrapped-as-native app).
i noticed android (tested 2.3 emulator , galaxy s device) reduces quality of loaded images if image dimensions exceed threshold (width above 1400 px or so). create impossible load big bitmap images (2000 x 2000 px) without quality going unusable.
i tested by
loading 1 big image , drawing on - got pixel garbage out. if draw grid lines using lineto() on have perfect quality, bad must in image pixel data
slicing big image 100 x 100 slices , drawing them canvas - method found resulting no quality reduction. however, slicing cumbersome, adds step preprocess images , page loading times suffers
i tested tring load image new image() object, tag , css background: suffers reduced quality, suspect probelm image loader itself
i tried css image-rendering https://developer.mozilla.org/en/css/image-rendering - no luck
viewport tag seems have no effect image loading - info garbage when seek touch loaded pixel data. tried possible values suggested in android's sdk documentation http://developer.android.com/reference/android/webkit/webview.html
tested firefox mobile, desktop browsers, ios: there.
so, going on - android webview can't load big images?
(smiley of hung android robot here)
android unconditionally resamples images , reduces quality if threshold of memory usage exceeded.
http://android.git.kernel.org/?p=platform/external/webkit.git;a=blob;f=webcore/platform/graphics/android/imagesourceandroid.cpp
there no way access orignal image info in intact.
i posted question regardging android-developers google grouping , kindly asking maybe provide kind of flag opt-out behavior.
meanwhile, if considering developing html5 web apps , might utilize big images, need preprocess them on server-side slicing, send in smaller images device , reconstuct orignal image using or putting many tags within container element.
another alternative load image "manually" writing png decoder straight loads image , bypassing imagesourceandroid class.
android image html5 canvas webview
Comments
Post a Comment