A UIImageView extension to let the picture-cutting with faces showing better

Overview

Build Status

UIImageView-BetterFace

A UIImageView extension to let the picture-cutting with faces showing better

Last update in v0.2_stable : add a UIImage+BetterFace category, so clipping images becomes possible(clap!)

Looking for an Android version? Check this! [https://github.com/beartung/tclip-android]

##Why?

  • Have problems showing the resized image previews?
  • People in the preview only have chins but not faces?
  • A group photo doesn't look well?

Try UIImageView-BetterFace!

Like this:

preview

##How?

  1. Drag UIImageView+BetterFace.h and UIImageView+BetterFace.m to your project
  2. Add CoreImage.framework to your project
  3. Import the .h file
  4. Add this:[anImageView setNeedsBetterFace:YES];
  5. If you want all setImage: methods do the magic: Add hack_uiimageview_bf(); to your main function; Otherwise call setBetterFaceImage: for every image you want to make the face detection.
  6. Done
  7. Still have problems? clone the project and see the demo.

##Too slow?

try set the fast property to YES to get the faster speed(lower accuracy)

##Known issues

  • it will be slow to render large-size images, and showing the strange animation
  • it may take a lot of memory while reusing the UIImageView

##Who use BetterFace?

If you're building your applications using UIImageView-BetterFace, please let me know! (add your application name & App Store link here and pullreuqest this README~

##Debugging Add BF_DEBUG to your pre compile macros or #define BF_DEBUG to your prefix.pch file in order to see turn ON debugging logs on the console.

##Other

Any issue and pull request is welcome.

Comments
  • Cycle call?。。。

    Cycle call?。。。

    - (void)setBetterFaceImage:(UIImage *)image{ [self setBetterFaceImage:image]; // Cycle Call? }

    if I don't want to hack setImage, this is a Cycle Call.

    opened by candyan 2
  • Added a way to turn ON and OFF Logs, just define BF_DEBUG on the prefix ...

    Added a way to turn ON and OFF Logs, just define BF_DEBUG on the prefix ...

    Added a way to turn ON and OFF Logs, just define BF_DEBUG on the prefix file or add it on the compile macro to turn it ON.

    In the demo project I added it on the prefix file.

    opened by Julioacarrettoni 1
  • CIDetector as a Singleton

    CIDetector as a Singleton

    Moved the CIDetector as a singleton as there was some overhead in the creation of new CIDetectors which Apple's Documentation recommends against. https://developer.apple.com/library/ios/documentation/CoreImage/Reference/CIDetector_Ref/Reference/Reference.html

    This should improve the performance of UIImageViews inside scroll views.

    opened by neoplastic 0
  • CIDetector will now only init once.

    CIDetector will now only init once.

    Core Image Contexts/Detectors should be initted (yes that's made up) as sparsely as possible. The reason being is each time you init one you're using GPU compute and memory. This competes with a things like UIScrollViews which are very GPU intensive.

    CIDetector is still very resource hungry and I've only tested this code on an iPad Air for performance where its usable, around 40fps rather than 60fps.

    opened by neoplastic 0
  • Memory so high

    Memory so high

    First of all, The open source is so cool. Thanks.

    In TableView. When I download image from server Use SDWebImage.
    The memory is so high. and how can I reduce the memory ? Can you give me some opinions?

    opened by CocoaML 0
  • UIImage+BetterFace,betterFaceImageForSize: accuracy:  how  to use size param

    UIImage+BetterFace,betterFaceImageForSize: accuracy: how to use size param

    At UIImage+BetterFace.h,

    - (UIImage *)betterFaceImageForSize:(CGSize)size accuracy:(BFAccuracy)accurary;
    

    how to use size parameter? use image size? or UIImageView size?

    opened by erduoniba 0
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Bug? ImageView doesn't change its image if new image is from Camera.

    Bug? ImageView doesn't change its image if new image is from Camera.

    Full code:

    Repro steps:

    1. App should let user to choose between photo library and camera as a source of the new image.
    2. Select a photo with two faces that works 100% with BetterFace library from the Photo Library.
    3. After seeing that BF works fine with the photo from the Photo Library, now select a new photo using the Camera as a source.
    4. ImageView still has the old photo from the Photo Library.

    Any ideas? I've been debugging this for an hour already.

    extension VerificationViewController: UIPickerViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
        
        func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
            picker.dismiss(animated: true, completion: {
                if let newImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
                    
                    let normalizedImage = newImage.normalizeImage()
    
                    self.imageView_ProfilePicture.needsBetterFace = true
                    self.imageView_ProfilePicture.fast = true
                    self.imageView_ProfilePicture.setBetterFaceImage(normalizedImage)
                    self.imageView_ProfilePicture.makeRoundCorners()
                    
                    self.imageData = UIImageJPEGRepresentation(normalizedImage, 0.75)
                    
                    UIView.animate(withDuration: 0.3) {
                        self.label_WarningUploadPhoto.isHidden = self.imageData != nil
                    }
                }
            })
        }
    }
    
    
    opened by glennposadas 0
Owner
Croath Liu
Croath Liu
iOS Picture In Picture Sample with Swift Language

PipSamleProject iOS Picture In Picture Sample with Swift Language Application Demo Resources Apple Adopting Picture in Picture Sample Video License MI

PeterLin 1 Oct 12, 2021
Pipable is an iOS library to implement Picture in Picture for any UIView.

Pipable Pipable is an iOS library to implement Picture in Picture for any UIView. This is done just by conforming to a protocol. The "Audio, AirPlay a

Emma Cold 11 Nov 3, 2022
A SwiftUI component for launching custom picture-in-picture experiences

Pipify for SwiftUI This library introduces a new SwiftUI modifier that enables a view to be shown within a Picture in Picture overlay. This overlay al

Sidetrack 99 Dec 16, 2022
A simple UIImageView extension for using initials as a profile image, written in swift

InitialsImageView An easy, helpful UIImageView extension that generates letter initials as a placeholder for user profile images, with a randomized ba

Tom Bachant 215 Dec 17, 2022
Async image downloader with Mem&Disk cached as a UIImageView extension

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

haoboxuxu 1 Oct 22, 2022
✂️ Detect and crop faces, barcodes and texts in image with iOS 11 Vision api.

ImageDetect ImageDetect is a library developed on Swift. With ImageDetect you can easily detect and crop faces, texts or barcodes in your image with i

Arthur Sahakyan 299 Dec 17, 2022
Utilizing Apple's Vision Framework to center faces in CGImage.

FaceCrop CGImage extension that utilizes Apple's Vision Framework to detect and center faces. Usage cgImage.faceCrop { [weak self] result in switc

Ancestry.com 40 Nov 24, 2022
Crop faces, inside of your image, with iOS 11 Vision api.

FaceCropper Requirements Xcode 9.0 (beta) or higher. iOS 11.0 (beta) or higher. (It is possible to import this library under the iOS 11. But it won't

Taejun Kim 488 Dec 17, 2022
A framework that lists all photos in the album that contain faces.

FaceCollectionViewKit A framework that lists all photos in the album that contain faces. Features It uses the detection features of CIDetectorTypeFace

Serhat Akalın 2 Aug 30, 2022
Asynchronous image downloader with cache support as a UIImageView category

This library provides an async image downloader with cache support. For convenience, we added categories for UI elements like UIImageView, UIButton, M

null 24.4k Jan 5, 2023
UIImageView BetterFace Swift

UIImageView BetterFace Swift

Croath Liu 470 Sep 9, 2022
iOS Framework that makes it easy to preview images on any UIImageView.

AZImagePreview iOS Framework that makes it easy to preview images on any UIImageView. Screenshots Installation: Cocoa Pods: pod 'AZImagePreview' Swift

Antonio Zaitoun 25 Dec 11, 2022
Live rendering of UIImageView properties in Interface Builder

TJProfileImage Live rendering of componet’s properties in Interface Builder Features Dashed border Solid border Round corner Circle image Requirements

Tejas Ardeshna 32 Feb 28, 2022
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.

I've built out the Swift version of this library! Screenshots Description ABMediaView can display images, videos, as well as now GIFs and Audio! It su

Andrew Boryk 80 Dec 20, 2022
Space! – an iOS widget displaying NASA's Astronomy Picture of the Day

Space! NASA's Astronomy Picture of the Day – now on your Home Screen with widgets! Space! displays the latest APOD photo curated by NASA every day. Se

Jacob Bandes-Storch 72 Dec 17, 2022
This simple cordova plugin will download picture from an URL and save to IOS Photo Gallery.

Photo Viewer This plugin is intended to download a picture from an URL into IOS Photo library.. How to Install Cordova: cordova plugin add https://git

Alwin jose 1 Oct 23, 2021
A apple music cover picture shadow style image library

ShadowImageView A apple music cover picture shadow style image library ShadowImageView is a iOS 10 Apple Music style image view, help you create elege

Old Donkey 794 Dec 17, 2022
Picture anonymiser using Vision face recognition

?? Anonymojizer [WIP] Anonymize people in photos by replacing their faces by emojis. How to use it ? Pick a photo from the gallery Choose an emoji The

Kaww 1 Dec 20, 2021
URLImage is a package that holds an easy way of showing images from an URL.

URLImage Overview URLImage is a package that holds an easy way of showing images from an URL. Usually this processes should take the following process

Ramón Dias 1 Nov 1, 2021