CBLImageManipulationHelpers
Objective-C
@interface CBLImageManipulationHelpers : NSObject
Swift
class ImageManipulationHelpers : NSObject
Helper class for working with image data.
-
Rotates an image to orient it based on the given EXIF rotation value.
Declaration
Objective-C
+ (nullable NSData *)imageDataByRotatingImageData:(nonnull NSData *)sourceData forRotation:(CBLExifRotation)rotation;Swift
class func imageData(byRotatingImageData sourceData: Data, for rotation: ExifRotation) -> Data?Parameters
sourceDataThe source image data.
rotationThe EXIF rotation to apply to the image data.
Return Value
The rotated image, or
nilif the given data wasn’t a valid image or an error occurred. -
Crop the given thumbnail image based on the given metadata.
Embedded thumbnails tend to be of a fixed size no matter the size and aspect ratio of the original image. This can result in black bars being encoded into the thumbnail image. This image will attempt to derive and perform a sensible crop based on the passed ImageIO metadata.
Declaration
Objective-C
+ (UIImage *_Nonnull)cropMetadatalessThumbnail:(nonnull CGImageRef)thumbnail basedOnMetadata: (nullable NSDictionary *)metadata;Swift
class func cropMetadatalessThumbnail(_ thumbnail: CGImage, basedOnMetadata metadata: [AnyHashable : Any]?) -> UIImageParameters
thumbnailThe thumbnail image to crop.
metadataThe metadata to derive the crop factor from.
Return Value
The cropped image.
-
Crop the given thumbnail image to the given aspect ratio.
Declaration
Objective-C
+ (UIImage *_Nonnull)cropMetadatalessThumbnail:(nonnull CGImageRef)image toPreRotationRatio:(CGFloat)ratio;Swift
class func cropMetadatalessThumbnail(_ image: CGImage, toPreRotationRatio ratio: CGFloat) -> UIImageParameters
imageThe image to crop.
ratioThe aspect ratio to crop to.
Return Value
The cropped image.