GithubHelp home page GithubHelp logo

starkdmi / swiftorientcrop Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 37.25 MB

Working with oriented images in Swift

License: MIT License

Swift 100.00%
cgimage ciimage crop-image image-manipulation image-processing swift vimage

swiftorientcrop's Introduction

SwiftOrientCrop

Project content:

  • Oriented image generator
  • Load and orient CGImage and CIImage
  • Orient CGRect based on image orientation
  • Crop CGImage, CIImage and vImage
  • Benchmarks

Code located in Tests.

Oriented image generator

Those images looks the same when correctly displayed, but under the hood they pretty different.

Usage

try OrientedGenerator.generateFrom(
  source: sourceImageFile,
  destination: destinationDirectory,
  format: .jpeg,
  size: CGSize(width: 1280, height: 1280),
  quality: 0.75
)

Image Crop Benchmarks

One call equals to loading 8 images, crop them and write image data to file. Full execution is 10 single calls - 80 images in summary.

Method Full Execution Time (seconds) Average Execution Time per call (seconds) Average CPU Time (seconds) Memory Usage (kB) Memory Peak Physical (MB) Disk Writes (MB) CPU Usage (% relative to CGImage)
CGImage 38.719 6.372 5.365 101.6 11.6 9.0 100%
CIImage 14.432 2.352 1.344 62.3 15.0 10.9 29.3%
vImage (CG)* 31.458 5.186 5.162 55.7 11.7 9.0 23.8%
vImage (CI)* 30.431 4.933 4.445 - 15.4 11.0 28.8%

* vImage doesn't have API to load and save image files, so the CGImage and CIImage was used for it.

swiftorientcrop's People

Contributors

starkdmi avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.