Get Started

This guide shows you how to include the TinyCrayon SDKs in the TCMaskPopView example project.

Download TCMaskPopView example


Prerequisites


  • Xcode 8.0 or later.
  • A physical iOS device.
  • Recommended: Install CocoaPods to simplify dependency management

Overview


TinyCrayon SDK provides tools for adding image cutout and layer mask capabilities to your mobile applications.

Image layer mask is a fundamental technique in image manipulations. It allows you to selectively modify the opacity (transparency) of the layer they belong to. This flexibility to define the opacity of different areas of a layer is the basis for more interesting image manipulation techniques such as selective coloring and luminosity masking.

The current version of TinyCrayon SDK provides the following three tools:

  • Quick Select: Smart and easy to use, you just need to select part of the object and the edge detection algorithm will find the boundary for you.
  • Hair Brush: Smooth and natual looking, paint on the hair/fur of an object and the algorithm will select the hair/fur for you in high quality.
  • Regular Brush: A regular brush tool with the capability to adjust its size, hardness and opacity.

To get an overview of the tools, try our sample app Image Eraser


Add the SDK


Streamlined, using CocoaPods

TinyCrayon SDK is available via CocoaPods. If you're new to CocoaPods, this Getting Started Guide will help you. CocoaPods is the preferred and simplest way to use the TinyCrayon SDK.

Important: Please make sure that you have a CocoaPods version >= 0.39.0 installed. You can check your version of CocoaPods with pod --version.

Here's what you have to add to your Podfile (if you do not have Podfile, create one in your project root directory):

target 'MyApp' do
  pod 'TinyCrayon' 
end

Run pod install from the terminal, in the same directory as the Podfile. Once the installation finishes, open MyApp.xcworkspace and build, your project files should include a Pods project with new dependencies for TCCore and TCMask.

Manually, using the SDK download

If you don't want to use Cocoapods you can still take advantage of the TinyCrayon SDKs by importing the frameworks directly.

Download the SDK

  1. Download the TinyCrayon SDK zip (this is a ~20MB file and may take some time).
  2. Unzip the TinyCrayon.zip

Add the framework

Right-click on the TCMaskPopView project, and choose Add Files to "TCMaskPopView".

Responsive image

Click Options at the bottom of the screen and check the Copy items if needed checkbox. Then click Add to add the TCCore.framework and TCMask.framework.

Responsive image

Click on the TCMaskPopView project, in Targets->TCMaskPopView, in General tab, under Embedded Binaries, click +

Responsive image

Click Add to add the TCMask.framework to embedded binaries

Responsive image

Finally, the framework dependency looks like the following:

Responsive image


Settings for Objective-C

TinyCrayon is written in Swift, if your project is using Objective-C, you need to set Always Embed Swift Standard Libraries to be YES in your Build Settings.

This build setting, which specifies whether a target's product has embedded content with Swift code, tells Xcode to embed Swift standard libraries in your app when set to YES. See more.

Responsive image



Build and run the app

Build and run the app. This time, a TCMaskView is popped up.

Responsive image

What's next


To see how to integrate TCMaskView in UINavigationViewController, check out the TCMaskNavigationView example

To see how to incorporate your image editing app with image mask, check out the guide Work with Layer Mask

To see how to customize view mode or UI styles, check out the guide Customization.