Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/starkdmi/swiftorientcrop
Working with oriented images in Swift
https://github.com/starkdmi/swiftorientcrop
cgimage ciimage crop-image image-manipulation image-processing swift vimage
Last synced: about 8 hours ago
JSON representation
Working with oriented images in Swift
- Host: GitHub
- URL: https://github.com/starkdmi/swiftorientcrop
- Owner: starkdmi
- License: mit
- Created: 2023-08-24T16:36:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-25T14:32:41.000Z (about 1 year ago)
- Last Synced: 2023-08-25T19:05:58.975Z (about 1 year ago)
- Topics: cgimage, ciimage, crop-image, image-manipulation, image-processing, swift, vimage
- Language: Swift
- Homepage:
- Size: 35.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftOrientCrop
Project content:
- Oriented image generator
- Load and orient CGImage and CIImage
- Orient CGRect based on image orientation
- Crop CGImage, CIImage and vImage
- BenchmarksCode located in [Tests](SwiftOrientCropTests/SwiftOrientCropTests.swift).
## Oriented image generator
Those images looks the same when correctly displayed, but under the hood they pretty different.
| | | |
| --- | --- | --- |
| | | |
| | | |### Usage
```Swift
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.