Swiftpack.co - S2Ler/SwiftyImageIO as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by S2Ler.
S2Ler/SwiftyImageIO 0.4.0
A swift wrapper around ImageIO framework
⭐️ 16
🕓 3 weeks ago
.package(url: "https://github.com/S2Ler/SwiftyImageIO.git", from: "0.4.0")

SwiftyImageIO

Swift SPM Ready Version License Platform Carthage compatible

Swift wrapper around ImageIO framework.

Usage

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

Examples

Create image thumbnail

import SwiftyImageIO

let source = ImageSource(data: imageData, options: nil)
let thumbnailCGImage = source?.createThumbnail(maxPixelSize: thumbnailSize)

Write image to disk

import SwiftyImageIO
import MobileCoreServices

if let imageDestination = ImageDestination(url: saveURL, UTI: kUTTypeJPEG, imageCount: 1) {
  imageDestination.addImage(cgImage)
  let imageSaved = imageDestination.finalize()
}

Create GIF from animated UIImage

let gifMaker = GIF()
try gifMaker.makeGIF(fromAnimatedImage: animatedImage,
                     writeTo: savePath,
                     properties: GIF.Properties(loopCount: 1),
                     frameProperties: GIF.FrameProperties(delayTime: 0.1))

Read GPS image properties

let source = ImageSource(url: jpgWithExifImageURL, options: nil)
guard let properties = source?.propertiesForImage() else {
  XCTFail("We created image without properties.");
  return
}
guard let gpsProperties = properties.get(GPSImageProperties.self) else {
  XCTFail("GPS Not available")
  return
}

Test examples

Test Examples

Installation

CocoaPods

pod "SwiftyImageIO"

Swift Package Manager

dependencies: [
    .Package(url: "https://github.com/diejmon/SwiftyImageIO.git", majorVersion: 0, minor: 4)
]

Carthage

github "diejmon/SwiftyImageIO" ~> 0.4

EXIF

The list of exif values can be found in this document

Author

Alexander Belyavskiy, diejmon@gmail.com

License

SwiftyImageIO is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 16
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

0.4.0
2 years ago
  • Swift 5.1
  • >iOS 13, macOS >10.15
  • Limited support for older release will be added in the future (PRs are welcome)
  • Rewritten Options abstraction
  • Added a way to write/read EXIF and similar properties (WIP, PRs are welcome)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics