Skip to content

Instantly share code, notes, and snippets.

View J0ker98's full-sized avatar
🎯
Focusing

Stefano Zeppieri J0ker98

🎯
Focusing
View GitHub Profile
@J0ker98
J0ker98 / UIImage+removeBackground.swift
Created November 12, 2020 21:53
Swift 5 UIImage white background removal
extension UIImage {
func removeBackground() -> UIImage? {
if let rawImageRef = self.cgImage {
let colorMasking: [CGFloat] = [200, 255, 200, 255, 200, 255]
UIGraphicsBeginImageContext(self.size)