decode - Android BitmapFactory decodeStream() -
i have question seem find answer nowhere. lines of code:
final bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds = true; bitmapfactory.decodestream(is, null, options);
actually mean that, file being downloaded? android docs this:
decode injustdecodebounds=true check dimensions
and does:
options.insamplesize = calculateinsamplesize(options, reqwidth, reqheight); // decode bitmap insamplesize set options.injustdecodebounds = false; bitmapfactory.decodestream(is, null, options);
means download file smaller (not downloaded original size , copied after smaller size bitmap).
clear example: have url's point many 2000 x 1500 images. decoding files , loading them bitmaps, need have enough memory downloading file @ full resolution (2000 x 1500), if need thumbnails of (200 x 150)?
i know answer has been accepted right 1 clarity...
this line options.injustdecodebounds = true;
means call bitmapfactory.decodestream(is, null, options);
doesn't bitmap information bounding information , mimetype.
you can use these returned values, outwidth
, outheight
, outmimetype
'resampled' version of bitmap data setting options.injustdecodebounds = false;
, setting sample size given ratio determined desired output dimensions options. insamplesize = [int]
.
see informative page more information: loading large bitmaps efficiently
Comments
Post a Comment