     
     /// UIView 转 UIImage
     static func image(with view: UIView) -> UIImage? {
-        UIGraphicsBeginImageContextWithOptions(view.frameSize, false, 0)
+        UIGraphicsBeginImageContextWithOptions(view.frameSize, true, 0)
         guard let context = UIGraphicsGetCurrentContext() else {
             return nil
         }

    /// - parameter rect: 矩形框
    /// - parameter corner: 是否圆角
    static func image(with view: UIView, rect: CGRect, corner: Bool = false) -> UIImage? {
        UIGraphicsBeginImageContextWithOptions(view.frameSize, false, 0)
        guard let context = UIGraphicsGetCurrentContext() else {
            return nil
        }

    
    /// 图片压缩
    func compress(size: CGSize) -> UIImage? {
        UIGraphicsBeginImageContextWithOptions(size, false, 0)
        self.draw(in: CGRect(origin: CGPoint(), size: size))
        let newImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
