压缩图片有白边

http://blog.csdn.net/chelongfei/article/details/51680478

只需要将所有的CGFloat转化为NSInteger即可

    func imageScaleSize(newSize: CGSize) -> UIImage{

        let width = NSInteger(newSize.width)

        let height = NSInteger(newSize.height)

        UIGraphicsBeginImageContext(CGSize( width, height: height));

        self.drawInRect(CGRect(x: 0, y: 0, width, height: height))

        let newImage = UIGraphicsGetImageFromCurrentImageContext()

        UIGraphicsEndImageContext();

        return newImage;

    }

原文地址:https://www.cnblogs.com/tufei7/p/8038225.html