iOS Image Processing API to edit photo programmatically. This library is used by react-native-photo-manipulator.
Add dependency Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Demo' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Add WCPhotoManipulator
pod 'WCPhotoManipulator', :git => 'https://github.com/guhungry/ios-photo-manipulator.git', :tag => 'v2.4.3'
end
or
Add dependency in Package.swift
dependencies: [
...,
.package(url: "https://github.com/guhungry/ios-photo-manipulator.git", from: "2.4.3"),
...,
],
Import using
@import WCPhotoManipulator;
Crop image from specified cropRegion
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
cropRegion | CGRect | Yes | Region to be crop in CGRect(x , y , size , width ) |
scale | CGFloat | No | Scale of result image. Default = image.scale |
Resize image from specified into targetSize
using resize mode cover
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
targetSize | CGSize | Yes | Size of result image |
scale | CGFloat | No | Scale of result image. Default = image.scale |
Print text into image
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
text | NSString | Yes | Text to print in image |
position | CGPoint | Yes | Position to in in x , y |
color | UIColor* | Yes | Text color |
font | UIFont | Yes | Font to use |
thickness | Float | No | Outline of text. Default = 0 |
rotation | Float | No | Rotation angle in degrees |
scale | CGFloat | No | Scale of result image. Default = image.scale |
Overlay image on top of background image
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
overlay | UIImage* | Yes | Overlay image |
position | CGPoint | Yes | Position of overlay image in background image |
Flip the image horizontally, vertically or both
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
mode | FlipMode | Yes | Flip mode .Vertical or .Horizontal or .Both |
Rotate the image 90°, 180° or 270°
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
mode | RotationMode | Yes | Rotation mode .R90 (90° Clockwise), .R180 (180° Half Rotation) or .R270 (270° Clockwise, aka 90° Counterclockwise) |
Create temp file into cache directory with prefix
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
prefix | NSString | Yes | Temp file name prefix |
mimeType | NSString | Yes | Mime type of image. Default = image/jpeg |
Get cache path of app
Delete all files in directory with prefix
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
directory | NSString | Yes | Path to clean |
prefix | NSString | Yes | File name prefix to match |
Save image to target path
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
image | UII mage | Yes | Source image |
mimeType | NSString | Yes | Mime type of target file |
quality | CGFloat | Yes | Quality of image between 0 - 1(For jpg only) |
file | NSString | Yes | Target file path |
Open file from uri as input stream
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
uri | String | Yes | Uri of image can be remote (https?://) or local (file://) |
Get image file extension from mimeType (Support .jpg, .png and .webp)
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
mimeType | String | Yes | Image mime type |