// Use BitmapFactory to generate Bitmap
// Note that this method only generates Bitmap, so the returned value is a Bitmap.
// Operations on Bitmap objects are not involved, such as rotating and compressing Bitmap objects.
// The following are four common methods:
// 1 generate Bitmap Based on the file path
// This method is also one of the methods for obtaining thumbnails.
// Another method for obtaining thumbnails is to call the class method directly.
// Focus on the input parameter opts
// ThumbnailUtils. extractThumbnail ();
// It can be understood as follows: since a scaling chart is generated
// New Bitmap, so of course the BitmapFactory. decodeFile () method should be called.
Bitmap bitmap1 = BitmapFactory. decodeFile (pathName, opts );
// 2 generate Bitmap from local resources
Bitmap bitmap2 = BitmapFactory. decodeResource (res, id );
// 3 generate Bitmap from the input stream
Bitmap bitmap3 = BitmapFactory. decodeStream (inputStream );
// 4 generate Bitmap from byte array
Bitmap bitmap4 = BitmapFactory. decodeByteArray (data, offset, length );
// After generating a Bitmap, the Bitmap operations are summarized as follows:
// 1. compress the Bitmap width and height to rotate and tilt Bitmap.
// And other operations call the Bitmap. createBitmap () method of the class method. The matrix parameter is very important.
Bitmap bitmap5 = Bitmap. createBitmap (rawBitmap, x, y, width, height, matrix, filter );
// 2 save Bitmap to the file. The object method of Bitmap is called.
Bitmap5.compress (format, quality, OS );