Writing in the front

Recently, I have summarized the content related to image processing. When I was working in 2003, 2004 and 2005, I also shared about this aspect. There are a lot of image processing content, which will be divided into many modules to explain. Today, simple multi - picture Mosaic.Copy the code

DDGScreenShot all feature presentations

In the code

func composeImageWithLogo( bgImage: UIImage, imageRect: [CGRect], images:[UIImage]) -> UIImage {// withbgThe size of Image is the base Imagelet imageRef = bgImage.cgImage
        letw: CGFloat = CGFloat((imageRef? .width)!)leth: CGFloat = CGFloat((imageRef? .height)!) / / to 1. The PNG image size of the canvas to create context UIGraphicsBeginImageContext (CGSize (height: width: w, h))bgImage.draw(inPNG (x: 0, y: 0, width: w, height: h)for i in0.. <images.count { images[i].draw(in: CGRect(x: imageRect[i].origin.x, y: imageRect[i].origin.y, width: imageRect[I].size. Width, height:imageRect[I].size. Height))letresultImg: UIImage? = UIGraphicsGetImageFromCurrentImageContext () / / to get from the current context UIGraphicsEndImageContext final photo ()return resultImg!
    }
Copy the code

The above notes have been very clear, of course, to say that the picture processing is so much content, is not too little. Due to limited space and incomplete code annotations, I have organized the above functions into the latest tripartite library, and will add related processing of pictures in the future, such as beauty, cutting, Mosaic, grouping, etc. Attached is my Git address: [making address] (https://github.com/dudongge/DDGScreenShot), have what problem can contact me QQ: 532835032 if you have any help to you, please feel free to star, increase my motivation for updatesCopy the code

Welcome to DDGScreenShot

The remaining functions are as follows

  1. DDGScreenShot – Complex screen screenshots (such as View ScrollView webView wkwebView)
  2. (2)DDGScreenShot- iOS image processing – multi-image Mosaic
  3. DDGScreenShot–iOS images cropped, cut corners, add borders, and you use a cornerRadius, and there are more advanced uses
  4. (4)DDGScreenShot – Picture eraser function
  5. (5)DDGScreenShot – Take any part of an image
  6. (6)DDGScreenShot – pictures with a variety of filters high screen operation