// Use BitmapFactory to generate Bitmap // note that this method only generates Bitmap, so the returned value is a Bitmap // and does not involve operations on Bitmap objects, such as rotating them, the following are four common compression methods: // 1 generate Bitmap Based on the file path // This method is also one of the methods for obtaining the thumbnail // another method for obtaining the thumbnail is to directly call the class method // The focus is to pass in the opts/Parameter/ /ThumbnailUtils. extractThumbnail (); // it can be understood as follows: since a scaling chart is generated, it is actually a // new Bitmap, so of course BitmapFactory should be called. decodeFile () method. bitmap bitmap1 = BitmapFactory. decodeFile (pathName, opts); // 2 generate BitmapBitmap bitmap2 = BitmapFactory from local resources. decodeResource (res, id); // 3 generate BitmapBitmap bitmap3 = BitmapFactory from the input stream. decodeStream (inputStream); // 4 generates BitmapBitmap bitmap4 = BitmapFactory from the byte array. decodeByteArray (data, offset, length); // after a Bitmap is generated, the Bitmap operation is summarized as follows: // 1. compress the Bitmap width and height, the Bitmap rotation and skew operations call Bitmap class methods. createBitmap () method. the matrix parameter is very important. Bitmap bitmap5 = Bitmap. createBitmap (rawBitmap, x, y, width, height, matrix, filter); // 2 save Bitmap to a file. the Bitmap object method bitmap5.compress (format, quality, OS) is called );