A smart and easy-to-use image masking and cutout SDK for mobile apps.

Overview

TinyCrayon SDK for iOS

A smart and easy-to-use image masking and cutout SDK for mobile apps.

Website platform Compatible CocoaPods Documentation App Store license

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

Quick Select Tool Hair Brush Tool
Quick Select Tool Hair Brush Tool

Try our sample apps Image Eraser, Color Effect, Focus Effect.

Table of Contents

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, users just need to select part of the object and the edge detection algorithm will find the boundary.
  • 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.

Notes

  • No Ads: From 5.0.1 and later versions, ads have been removed from the SDK.
  • UI customization: We are reorganizing the code now and will open source the swift code in the future, you will be able to customize your UI at that time.

Features

  • Free: TinyCrayon SDK is provided under MIT license, you can use it in your commercial applications for free!
  • iPad support: TinyCrayon SDK uses auto layout for its views and adapts to each screen size - iPhone or iPad.
  • Highly customizable: Style the UI, view modes and localized languages as you wish.
  • Swift: Keeping up with time, we chose Swift as the main development language of the TinyCrayon SDK, leading to leaner easier code.
  • Objective-C support: All of our public API is Objective-C compatible.

create as many effects as you can think of

Installation

Prerequisites

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

Then run pod install in your project root directory (same directory as your Podfile).

Open MyApp.xcworkspace and build.

Manually, using the SDK download

If you don't want to use Cocoapods you can still take advantage of the TinyCrayon SDK 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

  1. Drag TCCore.framework into the Linked Frameworks and Libraries section of your target.
  2. Drag TCMask.framework into the Embedded Binaries section of your target.

Add the framework

Settings for Objective-C

If your project is using Objective-C, set Always Embed Swift Standard Libraries to be YES in your Build Settings.

Usage

Add a TCMaskView

The TCMaskView class is responsible to create a UIViewController for the user to mask the image. To present a TCMaskView:

Swift

let maskView = TCMaskView(image: image)
maskView.delegate = self
maskView.presentFrom(rootViewController: self, animated: true)

Objective-C

TCMaskView *maskView = [[TCMaskView alloc] initWithImage:image];
maskView.delegate = self;
[maskView presentFromRootViewController:self animated:true];

The delegate of the TCMaskView can be used to be notified when the user cancels or completes the edit. In last case the function tcMaskViewDidComplete(mask:image:) is called.

TCMask class

TCMask is provided by TCMaskViewDelegate functions as the first parameter when the user cancels or completes the edit. For example, when the user completes the edit with TCMaskView:

swift

func tcMaskViewDidComplete(mask: TCMask, image: UIImage) {}

Objective-C

- (void)tcMaskViewDidCompleteWithMask:(TCMask *)mask image:(UIImage *)image {}

TCMask is an encapsulation of image masking result from TCMaskView, it has the following properties:

  • data: An array of 8-bits unsigned char, its length is equal to the number of pixels of the image in TCMaskView. Each element in data represents the mask value.
  • size: The size of mask, which is equal to the size of the image in TCMaskView.

TCMask also provides some simple and easy to use functions to process layer mask with image. For example, to cutout an object:

Swift

let outputImage = mask.cutout(image: image, resize: false)

Objective-C

UIImage *outputImage = [mask cutoutWithImage:image resize:false];

To try these examples, and find out about more options please take a look at the Examples.

Further reading

License

The MIT license

Comments
  • dyld: Library not loaded: @rpath/libswiftCore.dylib

    dyld: Library not loaded: @rpath/libswiftCore.dylib

    Using Xcode 8, it builds fine but is crashing right after launch with this error:

    dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/Jim/Library/Developer/CoreSimulator/Devices/71C3C61E-1604-48FF-813F-84985541B72A/data/Containers/Bundle/Application/850D7F48-B1CD-4FA8-A0C8-41ED890CF1CE/TCMaskPopView.app/Frameworks/TCMask.framework/TCMask Reason: image not found

    I've tried everything so far and no luck:

    • Runpath Search Paths: @executable_path/Frameworks
    • Always Embed Swift Standard Libraries = YES
    • Clean and Clean Build Folder...
    • Delete everything in Derived Data Folder
    • Reinstall Apple WWDR Certificate

    Is there any chance you can do an Objective C framework that doesn't rely on swift? This looks like a great framework and might be exactly what I need. Thanks! James

    opened by BrainFeverMedia 16
  • Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler

    Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler

    My project stopped compiling now that Apple released the Swift 5.0.

    The error code presented is:

    Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler: /Users/adriano/Documents/app/daily/stickers/Pods/TinyCrayon/TCMask.framework/Modules/TCMask.swiftmodule/x86_64.swiftmodule

    opened by adrianorezena 10
  • SSL Certificate Expired

    SSL Certificate Expired

    Installing TinyCrayon (5.0.0.0.0)

    [!] Error installing TinyCrayon [!] /usr/bin/curl -f -L -o /var/folders/56/6v10hl792hg8y_hr5k35zwpc0000gn/T/d20190611-79171-18mstgf/file.zip https://www.tinycrayon.com/sdk/iOS/TinyCrayon_v5.0.0.0.0.zip --create-dirs --netrc-optional --retry 2

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 curl: (60) SSL certificate problem: certificate has expired More details here: https://curl.haxx.se/docs/sslcerts.html

    curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.

    Screenshot 2019-06-11 at 4 04 16 PM

    opened by abbas-mulani 4
  • find some bugs

    find some bugs

    1.in the TCMaskBlendExample project demo, runing,that notice “Creating an image format with an unknown type is an error” in control.

    2..in the TCMaskCustomization project demo, runing,that notice “Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'” in control.

    opened by weiwei1991 4
  • Not able to make a built for development

    Not able to make a built for development

    Hello, Now I want to share the app for testing but Now I am not able to export my archive in Xcode in Organizer. Show error - Failed to verify bitcode in TCMask.framework/TCMask: error: Bundle only contains bitcode-marker /var/folders/_k/nm4x9ld1461cld7ssg_yhjnr0000gn/T/XcodeDistPipeline.U6t/Root/Payload/Demo.app/Frameworks/…

    I have set Enable Bitcode - "NO" as you suggest me to make archive. I appreciate your hard work and hope for the best. thank you Sushobhit jain

    opened by Sushobhitbuiltbyblank 3
  • archive will not generate on adding this library

    archive will not generate on adding this library

    I am using Xcode - Version 8.3.2 (8E2002) Code in Swift use cocoapod to add libray in xcode. I want to use this library the library work on run on simulator and device. but when i try to make Archive. Its shows below error - ld: bitcode bundle could not be generated because '/Users/path/Desktop/project-name/practical/Demo/Pods/TinyCrayon/TCMask.framework/TCMask' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

    I have search out the issue but get nothing fruitful. also follow this - http://stackoverflow.com/questions/31486232/how-do-i-xcodebuild-a-static-library-with-bitcode-enabled but still no luck. Please help me out.

    opened by Sushobhitbuiltbyblank 3
  • Compilation error: No member named 'Error' in namespace 'cv'

    Compilation error: No member named 'Error' in namespace 'cv'

    Hi @zengxinzhy

    image

    I followed the latest v6 readme, I compiled the project and Xcode showed the error above.

    May I know how to solve it? Or exactly which OpenCV2 version you are using?

    Sorry for questions again. Thanks!

    opened by ericcheungwork 2
  • Module compiled with Swift 4.0 cannot be imported in Swift 4.0.2

    Module compiled with Swift 4.0 cannot be imported in Swift 4.0.2

    After updating to Xcode 9.1 in order to test on iOS 11.1 devices, I couldn't run the project because of that error.

    Can you please recompile the framework and publish it?

    opened by Tawa 2
  • can't upload in  appstore after using it

    can't upload in appstore after using it

    Anyone Can solving this issues..

    ERROR ITMS-90087: "Unsupported Architectures. The executable for PosterMaker.app/Frameworks/TCMask.framework contains unsupported architectures '[x86_64, i386]'." ERROR ITMS-90087: "Unsupported Architectures. The executable for PosterMaker.app/Frameworks/TCMask.framework contains unsupported architectures '[x86_64, i386]’.”

    ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'PosterMaker.app/Frameworks/TCMask.framework/TCMask' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version." ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'PosterMaker.app/Frameworks/TCMask.framework/TCMask' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

    ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker." ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."

    opened by hardik27194 2
  • Layout issue for bottom and top bar new resolutions like iPhone XS and Max

    Layout issue for bottom and top bar new resolutions like iPhone XS and Max

    I have found this sdk very useful and I am thankful to Tiny for special efforts, there I find some layout issue for top and bottom bars please find some of your precious time to fix this one thanks.

    opened by hananahmad 1
  • Incompatible Library version

    Incompatible Library version

    Running TinyCrayon (3.2.1) with xCode 9.3, simulator returns an error stating "TCMask requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0" The issue seems to be caused by a difference in swift code versions between the framework and the target (as explained here). Any chance in getting an updated build for Swift 4.1?

    opened by RadionAtl 1
  • Operation timed out

    Operation timed out

    Pod can't installed.

    nstalling TinyCrayon (5.0.1)

    [!] Error installing TinyCrayon [!] /usr/bin/curl -f -L -o /var/folders/0s/q80b1n8s51xf925f8j7t3lf00000gn/T/d20220113-21855-75qxzm/file.zip https://www.tinycrayon.com/sdk/iOS/TinyCrayon_v5.0.1.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.2 cocoapods-downloader/1.4.0'

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:02:36 --:--:-- 0 curl: (7) Failed to connect to www.tinycrayon.com port 443: Operation timed out

    Is tinycron.com for sale ?

    opened by emirbeytekin 0
  • Module Not Compiled in Swift 5.1

    Module Not Compiled in Swift 5.1

    Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler: TinyCrayon/TCMask.framework/Modules/TCMask.swiftmodule/x86_64.swiftmodule

    I am getting this error as I compiled your libs in ios 13 support (swift 5.1) so I am getting this error, is there any fix for iOS 13 (Xcode 11.4)?

    ITMS-90725: SDK Version Issue - This app was built with the iOS 12.2 SDK. Starting April 2020, all iOS apps submitted to the App Store must be built with the iOS 13 SDK or later, included in Xcode 11 or later

    opened by Jatin-Deshaval 2
  • dyld: Library not loaded: @rpath/libswiftCore.dylib

    dyld: Library not loaded: @rpath/libswiftCore.dylib

    Facing the following issue while running the ionic ios project in Xcode. Xcode version 10.0 Mac OS Version 10.13.6

    dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/tejaswinc/Library/Developer/CoreSimulator/Devices/5F582F5B-E258-44B3-A77A-8DBB06740812/data/Containers/Bundle/Application/B47ABDA0-0A86-4969-845A-8B985CC52490/Jeerapowder.app/Frameworks/Razorpay.framework/Razorpay Reason: no suitable image found. Did find: /usr/lib/swift/libswiftCore.dylib: mach-o, but not built for iOS simulator

    Tried Embed Swift Standard Libraries = YES Clean and rebuilding project. Manually adding the path of libraries

    Quick help is appreciated.

    opened by Asha00 1
  • Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler

    Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler

    Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler: TinyCrayon/TCMask.framework/Modules/TCMask.swiftmodule/x86_64.swiftmodule Captura de Pantalla 2019-09-26 a la(s) 19 40 41

    opened by chuiizeet 19
  • png transparent

    png transparent

    Hi! I selected png and expected result like following.

    주석 2019-08-15 091356

    But the result is that transparent area is filled with black. Would you please help me how i can solve this problem?

    Regards, Adam.

    opened by AdamWorld 2
Very easy to use image loader for swift

Silo Silo is a extremely easy to use and very basic image loader for iOS built in Swift. if you use Silo in your project please let me know! Version 2

Jose Quintero 17 Dec 17, 2022
Mobile Text-to-Image search powered by multimodal semantic representation models(e.g., OpenAI's CLIP)

A Mobile Text-to-Image Search Powered by AI A minimal demo demonstrating semantic multimodal text-to-image search using pretrained vision-language mod

null 66 Jan 5, 2023
Mobile(iOS) Text-to-Image search powered by multimodal semantic representation models(e.g., OpenAI's CLIP)

Mobile Text-to-Image Search(MoTIS) MoTIS is a minimal demo demonstrating semantic multimodal text-to-image search using pretrained vision-language mod

Roy 66 Dec 2, 2022
Twitter Image Pipeline is a robust and performant image loading and caching framework for iOS clients

Twitter Image Pipeline (a.k.a. TIP) Background The Twitter Image Pipeline is a streamlined framework for fetching and storing images in an application

Twitter 1.8k Dec 17, 2022
📷 A composable image editor using Core Image and Metal.

Brightroom - Composable image editor - building your own UI Classic Image Editor PhotosCrop Face detection Masking component ?? v2.0.0-alpha now open!

Muukii 2.8k Jan 3, 2023
An image download extension of the image view written in Swift for iOS, tvOS and macOS.

Moa, an image downloader written in Swift for iOS, tvOS and macOS Moa is an image download library written in Swift. It allows to download and show an

Evgenii Neumerzhitckii 330 Sep 9, 2022
📷 A composable image editor using Core Image and Metal.

Brightroom - Composable image editor - building your own UI Classic Image Editor PhotosCrop Face detection Masking component ?? v2.0.0-alpha now open!

Muukii 2.8k Jan 2, 2023
AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.

URLImage URLImage is a SwiftUI view that displays an image downloaded from provided URL. URLImage manages downloading remote image and caching it loca

Dmytro Anokhin 1k Jan 4, 2023
AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.

AYImageKit AYImageKit is a Swift Library for Async Image Downloading. Features Async Image Downloading. Can Show Text Initials. Can have Custom Styles

Adnan Yousaf 11 Jan 10, 2022
A complete Mac App: drag an image file to the top section and the bottom section will show you the text of any QRCodes in the image.

QRDecode A complete Mac App: drag an image file to the top section and the bottom section will show you the text of any QRCodes in the image. QRDecode

David Phillip Oster 2 Oct 28, 2022
An instagram-like image editor that can apply preset filters passed to it and customized editings to a binded image.

CZImageEditor CZImageEditor is an instagram-like image editor with clean and intuitive UI. It is pure swift and can apply preset filters and customize

null 8 Dec 16, 2022
Convert the image to hexadecimal to send the image to e-paper

ConvertImageToHex Convert the image to hexadecimal to send the image to e-paper Conversion Order // 0. hex로 변환할 이미지 var image = UIImage(named: "sample

Hankyeol Park 0 Feb 26, 2022
Image-cropper - Image cropper for iOS

Image-cropper Example To run the example project, clone the repo, and run pod in

Song Vuthy 0 Jan 6, 2022
Use Swift to pack ambiguous image that display differently on Apple and Other devices

Aibmoe Use Swift to pack ambiguous image that display differently on Apple and O

Lakr Aream 2 Feb 3, 2022
Easy customizable avatar image asynchronously with progress bar animated

JDSwiftAvatarProgress ##Objective-C JDAvatarProgress is available in Objective-C also, JDAvatarProgress Usage To run the example project, clone the re

Jelly Development 86 May 16, 2022
ColorKit makes it easy to find the dominant colors of an image

ColorKit ColorKit is your companion to work with colors on iOS. Features Installation Sample Project Contributing License Features Dominant Colors Col

Boris Emorine 570 Jan 5, 2023
A free, multiplatform SDK for real-time facial motion capture using blendshapes, and rigid head pose in 3D space from any RGB camera, photo, or video.

mocap4face by Facemoji mocap4face by Facemoji is a free, multiplatform SDK for real-time facial motion capture based on Facial Action Coding System or

Facemoji 592 Jan 1, 2023
iOS SDK to share JPEG images with an expiration date

Ebblink iOS SDK A library to integrate Ebblink private image sharing capabilities into your iOS app. Table of Contents Getting Started Requirements Se

null 4 Apr 6, 2018
Contentful.swift : Swift Delivery SDK for Contentful

contentful.swift - Swift Delivery SDK for Contentful Swift SDK for the Contentfu

An Tran 1 Jan 6, 2022