PublicBitmap Inbitmap If set, Decode option "Object method, take a try to reuse this bitmap when loading content. Public intThe pixel density of the bitmap used by the indensity. PublicBoolean Indither If the jitter is true, the decoder will try to decode the image to jitter. Publicboolean ininputshareable This field to select Inpurgeable together. PublicBoolean Injustdecodebounds If set to true, the decoder will return null (bitmap), but output ... PublicBoolean inmutable If set, the decoding method always returns a mutable bitmap instead of a static one. PublicBoolean inpreferqualityoverspeed if Inpreferqualityoverspeed?? Set to True, the decoder will attempt to decode the reconstructed image at a higher quality, even at the expense of the decoding speed. Publicbitmap.config Inpreferredconfig If not NULL, this internal configuration decoder will attempt to decode. PublicBoolean inpurgeable If set to True, the generated bitmap is assigned to its pixels so that they can be purged if the system needs to reclaim memory. Public intInsamplesize if set to >a value of 1, which requires a decoder to perform a sub-sample of the original image, returns a smaller image to save memory. PublicBoolean inscaled When this flag is set, if the summer wind and intargetdensity are not 0, the bitmap will be adjusted to conform to the intargetdensity when loaded, instead of relying on it each time it is drawn to the graphics system on the canvas for scaling. Public intinscreendensity The pixel density of the actual screen being used. Public intThis bitmap of the pixel density of the intargetdensity destination will be drawn to. Public byte[] intempstorage temperature storage is used for decoding. PublicA Boolean mcancel indicates that the flags that have been called on this object are canceled. Public intoutheight The bitmap height, set the independent State injustdecodebounds. Publicstring Outmimetype If known, the MIME type of the decoded image of this string is set to. Public intOutwidth the width of the bitmap, setting the independent State injustdecodebounds.
Injustdecodebounds set to True,bitmapfactory.decodefile (String path, Options opt) will not really return a bitmap to you, it will just take it wide, high to get back to you, Will not consume too much memory.
New bitmapfactory.options (); true ; = bitmapfactory.decodefile (path, options); /* */
Width and Height: options.outwidth and Options.outheight
Gets a thumbnail of the size specified by the picture:
/*Calculate the height of the picture*/ /*Here's the idea, if you need more precision to keep the picture from morphing, you need to do the math yourself .*/ intHeight = options.outheight * $/Options.outwidth; Options.outwidth= $; Options.outheight=height; /*so you can really return a bitmap to you.*/Options.injustdecodebounds=false; Bitmap BMP=bitmapfactory.decodefile (path, options); Image.setimagebitmap (BMP);
To conserve memory, you also need to use the insamplesize member variable in the Bitmapfactory.options class:
$ ; In addition, in order to save memory we can also use the following several fields:= Bitmap.Config.ARGB_4444; // default is Bitmap.Config.ARGB_8888 /* */True ; true
Android bitmapfactory.options