Latest 1.4
Homepage https://github.com/Ovrchk/OVBlurKit
License MIT
Platforms ios 10.0
Authors

UIImage blurring tool that you will love ❤️

Features:

Features

Blurring in-memory images

override func viewDidLoad() {
    super.viewDidLoad()

    let imageView = UIImageView.init(frame: self.view.bounds)
    imageView.contentMode = .scaleAspectFit
    imageView.image = UIImage.init(named: "InputImage")!
    self.view.addSubview(imageView)

    OVImageBlurringEngine.makeImageBlurred(image: imageView.image!, blurRadius: 5) { (result) in
        imageView.image = result.image
    }
}

Canceling blur operation

You can cancel any blurring operation if you wish (for example when you reusing UITableViewCell):

let operationID = OVImageBlurringEngine.makeImageBlurred(image: image, blurRadius: 5) { (result) in
    //this block won't be called if operation will be cancelled before image processed
}

//some time later

OVImageBlurringEngine.cancelImageOperation(withID: operationID)

Receving and blurring remote images

OVBlurKit uses PINRemoteImage to process remote images as well as in-memory images.


let imageURL:URL! = nil//TODO: get image url somewhere

let operationID = OVImageBlurringEngine.makeRemoteImageBlurred(imageURL: imageURL, blurRadius: 10) {(result) in
    let blurredImage:UIImage? = result.image
}

//OVImageBlurringEngine.cancelRemoteImageOperation(withID: operationID)

Don’t need this functionality? Check out the Installation section

Caching

OVBlurKit supports caching for downloaded and processed images. By default it uses shared instance of PINCache

You can replace it with your own cache instance if you wish…

let cache = PINCache.init(name: "CustomCache")

//setup age limit, byte limit, etc

OVImageBlurringEngine.cache = cache

… or disable caching at all

OVImageBlurringEngine.cache = nil

Don’t need this functionality? Check out the Installation section

UIImageView extension

OVBlurKit includes an handy UIImageView extension:

let imageURL:URL! = nil//TODO: get image url somewhere

self.imageView.setRemoteImageToBlurURL(URL: imageURL, blurRadius:5)

UIImageView can cancel it’s operation at any time

self.imageView.cancelRemoteImageOperation()

Delivery modes support

When blurring an image, you can specify one of fast or highQuality delivery modes. Default is fast.

let image:UIImage! = nil //TODO: get an image somewhere

OVImageBlurringEngine.makeImageBlurred(image: image, blurRadius: 10, deliveryMode: .highQuality) { (result) in
    let blurredImage = result.image
}

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

OVBlurKit is available through CocoaPods. To install
it, simply add one if the following lines to your Podfile:

If you need all OVBlurKit features such as remote images support, caching, etc:

pod 'OVBlurKit'

If you need only in-memory images blurring without any extra dependencies such as PINRemoteImage, PINCache in your project

pod 'OVBlurKit/Core'

Author

Dmitry Overchuk, [email protected]

License

OVBlurKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "OVBlurKit",
    "version": "1.4",
    "summary": "Make UIImage blurred easily and safe",
    "description": "OVBlurKit provides fast and non-deadlocking image blurring toolkit using Apple's CIFilter under the hood",
    "homepage": "https://github.com/Ovrchk/OVBlurKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Ovrchk": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Ovrchk/OVBlurKit.git",
        "tag": "1.4"
    },
    "platforms": {
        "ios": "10.0"
    },
    "default_subspecs": "RemoteImageSupport",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "OVBlurKit/Classes/OVImageBlurringEngine.swift"
        },
        {
            "name": "RemoteImageSupport",
            "dependencies": {
                "PINRemoteImage": []
            },
            "source_files": "OVBlurKit/Classes/**/*"
        }
    ]
}

Pin It on Pinterest

Share This