// Obtain the public static bitmap scalebitmap (string SRC, int max) of the reduced image {// obtain the height and width of the image bitmapfactory. options = new bitmapfactory. options (); // This setting enables bitmapfactory. the image obtained by decodefile is empty, but the image information is written to options. injustdecodebounds = true; bitmapfactory. decodefile (SRC, options); // to improve the accuracy of the calculation ratio, the original 640 is reduced to 64 max = max/10; int be = options. outwidth/max; If (be % 10! = 0) be + = 10; Be = be/10; If (be <= 0) be = 1; options. insamplesize = be; // you can obtain the data options. injustdecodebounds = false; // get the image return bitmapfactory. decodefile (SRC, options);} // Add a watermark or add the public static bitmap watermarkbitmap (Bitmap SRC, bitmap watermark, String title) {If (src = NULL) {return NULL;} int W = SRC. getwidth (); int H = SRC. getheight (); // you need to handle the problem that the memory size exceeds when the image size is too large. Here, my image is very small, so do not write the corresponding Code Bitmap newb = bitmap. createbitmap (W, H, config. argb_8888); // create a new bitmap canvas CV = new canvas (NEWB); cv. drawbitmap (SRC, 0, 0, null); // draw SRC paint = new paint () at coordinates 0, 0; // Add the image if (watermark! = NULL) {int WW = watermark. getwidth (); int wh = watermark. getheight (); paint. setalpha (50); cv. drawbitmap (watermark, W-ww + 5, H-Wh + 5, paint); // Add the watermark to the bottom right corner of SRC} // Add the text if (title! = NULL) {string familyname = ""; typeface font = typeface. create (familyname, typeface. bold); textpaint = new textpaint (); textpaint. setcolor (color. red); textpaint. settypeface (font); textpaint. settextsize (22); // The staticlayout layout = new staticlayout (title, textpaint, W, alignment. align_normal, 1.0f, 0.0f, true); layout. draw (CV); // Add the upper left corner of the text. // cv. drawtext (title, 0, 40, paint);} cv. save (canvas. all_save_flag); // Save the CV. restore (); // store return newb ;}