Giter Club home page Giter Club logo

filtr's Introduction

Filtr

Version License Platform

Filtr is a Swift multi-platform (iOS/macOS/tvOS) framework that has 25 built in photo filter effects that you can apply to images in your app. It also has utilities that let you create your own filters with your favorite photo editor, using 3D LUT files.

This framework is what powers the Lochkamera macOS app.

Installation

Filtr is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Filtr"

Getting Started

Filtr

There are 25 built in filters. 10 crazy color ones, 10 extra regular filters, 5 black and white.

color1 - color10
extra1 - extra10
blackWhite1 - blackWhite5

This is how you would use one.

  // Create an EffectFilter with the type you want.
  let effectFilter = EffectFilter(type: .color3)
  // Apply an input intensity between 0 and 1.0
  effectFilter.inputIntensity = 1.0

  // Filtr also has a FadeFilter, popularized by VSCO and Instagram.
  let fadeFilter = FadeFilter()
  fadeFilter.intensity = 0.33

  // Add both or either effect you want to use to a FilterStack.
  let filterStack = FilterStack()
  filterStack.effectFilter = effectFilter
  filterStack.fadeFilter = fadeFilter

  // Finaly use Filtr to process the image with the filter stack.
  let filteredImage = Filtr.process(inputImage, filterStack: filterStack)

LUTConverter

Filtr uses a 3D Lookup Table (3D LUT) or Color Cube to create the filter effects.

You can create your own filters using one of these LUT images as a base.
32 x 32 identity LUT image
64 x 64 identity LUT image

Import them into Photoshop (or your favorite photo editor), apply any color effects to it (only color effects will work, no grains/alphas or any other advanced effects), then save the resulting image.

Then use the LUTConverter class to convert your image into 3D LUT data.

  let lutImage = UIImage(named: myLut)
  let lutData32 = LUTConverter.cubeDataForLut32(lutImage) // If you use the 32 x 32 LUT image
  let lutData64 = LUTConverter.cubeDataForLut64(lutImage) // Or if you use the 64 x 64 lut image

Then use your 3D LUT data to initialize a EffectFilter.

let effectFilter = EffectFilter(customFilter: lutData32, withDimension: .thirtyTwo)
effectFilter.inputIntensity = 0.7

Author

Daniel Lozano, [email protected]

License

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

filtr's People

Contributors

danlozano avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.