Julioacarrettoni/UIImageView_FaceAwareFill
概要
画像に Aspect Fill のコンテンツモードを適用するカテゴリです。顔を検出した場合は、画像の幾何学的中心ではなく、顔が中央に来るように配置します。
デザイン・メディア計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- 0
- 1か月
- 0
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルFaceAwareFill
This category applies Aspect Fill content mode to an image and if faces are detected it centers them instead of centering the image just by its geometrical center.
Based on this awesome post by @maniacdev
Example:

Installation
FaceAwareFill is available through CocoaPods, to install it simply add the following line to your Podfile:
pod "FaceAwareFill"
Usage
Import the category to your .m file or to your "prefix" file.
#import "UIImageView+UIImageView_FaceAwareFill.h"
Then AFTER setting the image property of a UIImageView do:
[imageView faceAwareFill];
That's all.
Enjoy!
Debugging
A red rectangle can optionally be displayed on faces for debugging.
To enable, add the following value to the preprocessor macros:
DEBUGGING_FACE_AWARE_FILL
Author
Julio Andrés Carretttoni, @dev_jac
Notes:
- You can change the CIDetectorAccuracy from low to high if it fails to detect faces but it will make the rendering slower :(
- BEWARE of this bug when running face detection on 64bit devices http://stackoverflow.com/questions/19018962/core-image-face-detection-broken-on-64-bit-ios
License
FaceAwareFill is available under the MIT license. See the LICENSE file for more info.
関連プロジェクトを探す
読み込み中…