PixelKit Examples


pod 'PixelKit'
import PixelKit
let image = ImagePIX()
image.image = UIImage(named: "Öland")
let finalPix: PIX = image
finalPix.view.frame = view.bounds
view.addSubview(finalPix.view)
let levels = LevelsPIX()
levels.inPix = image
levels.gamma = 0.5
levels.brightness = 1.5
let blur = BlurPIX()
blur.inPix = image
blur.radius = 1.0
let quantize = QuantizePIX()
quantize.inPix = image
quantize.fraction = 0.15
let transform = TransformPIX()
transform.inPix = image
transform.rotation = 0.125
transform.scale = 0.5
let edge = EdgePIX()
edge.inPix = image  
edge.strength = 10
let threshold = ThresholdPIX()
threshold.inPix = image
threshold.threshold = 0.35
let kaleidoscope = KaleidoscopePIX()
kaleidoscope.inPix = image
kaleidoscope.divisions = 12
kaleidoscope.mirror = true
kaleidoscope.rotation = 0.5
let twirl = TwirlPIX()
twirl.inPix = image
twirl.strength = 0.5
let feedback = FeedbackPIX()
feedback.inPix = image
feedback.feedPix =
    feedback._scale(by: 0.9) ~ image
let chromaKey = ChromaKeyPIX()
chromaKey.inPix = image
chromaKey.keyColor =
    LiveColor(hex: "697223")
chromaKey.range = 0.25
chromaKey.edgeDesaturation = 1.0
chromaKey.softness = 0.2
let cornerPin = CornerPinPIX()
cornerPin.inPix = image
cornerPin.corners.topRight =
    CGPoint(x: 0.75, y: 0.75)
cornerPin.perspective = true
let hueSat = HueSatPIX()
hueSat.inPix = image
hueSat.hue = 0.5
hueSat.sat = 0.5
let crop = CropPIX()
crop.inPix = image
crop.cropFrame = CGRect(
    x: 0.0, y: 0.0,
    width: 0.5, height: 1.0
)
let flipFlop = FlipFlopPIX()
flipFlop.inPix = image
flipFlop.flip = .x
let range = RangePIX()
range.inPix = image
range.inLow = 0.25
range.inHigh = 0.75
let sharpen = SharpenPIX()
sharpen.inPix = image
sharpen.contrast = 2.0
let slope = SlopePIX()
slope.inPix = image
slope.amplitude = 10
let sepia = SepiaPIX()
sepia.inPix = image
sepia.color = .orange
let flare = FlarePIX()
flare.inPix = image
flare.scale = 2
flare.count = 6
let clamp = ClampPIX()
clamp.inPix = image
clamp.low = 0.25
clamp.high = 0.75
let convert = ConvertPIX()
convert.inPix = image
convert.mode = .squareToCircle
let res1 = ResPIX(
    res: .custom(w: 15, h: 10))
res1.inPix = image
res1.extend = .hold
let res2 = ResPIX(
    res: .custom(w: 1500, h: 1000))
res2.inPix = res1
res2.interpolate = .nearest

Docs