Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nyx0uf/swiftyimages
A set of efficient extensions and classes for manipulating images and colors.
https://github.com/nyx0uf/swiftyimages
image-processing ios swift-3
Last synced: 3 months ago
JSON representation
A set of efficient extensions and classes for manipulating images and colors.
- Host: GitHub
- URL: https://github.com/nyx0uf/swiftyimages
- Owner: Nyx0uf
- License: mit
- Created: 2016-10-20T19:43:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-04T17:30:22.000Z (almost 6 years ago)
- Last Synced: 2024-10-12T14:40:10.985Z (3 months ago)
- Topics: image-processing, ios, swift-3
- Language: Swift
- Homepage:
- Size: 109 KB
- Stars: 123
- Watchers: 8
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftyImages
***SwiftyImages*** is the continuation of [NYXImagesKit](https://github.com/Nyx0uf/NYXImagesKit), it's more modern, uses *Swift 3* and requires at least *iOS 9.3*.
It's a framework which regroups a collection of useful extensions and classes to interact with images and colors.
## UIImage / CGImage extensions
### Filtering
1. Brighten
2. Contrast adjustment
3. Edge detection
4. Emboss
5. Gamma correction
6. Grayscale
7. Invert
8. Opacity
9. Sepia
10. Sharpen
11. Unsharpen
12. Blur### Masking
This extension is composed of a single method which allows to mask an image with another one, you just have to create the mask image you desire.
let maskedImage = myImage.masked(withImage: maskImage)
### Resizing
This extension can be used to crop to scale images.
#### Cropping
let croppedImage = myImage.cropped(toSize: CGSize(width, height))
You can crop your image by 9 different ways :
1. Top left
2. Top center
3. Top right
4. Bottom left
5. Bottom center
6. Bottom right
7. Left center
8. Right center
9. Center#### Scaling
You have the choice between two methods to scale images, the two methods will keep the aspect ratio of the original image.
let scaledImage1 = myImage.scaled(factor: 0.5)
let scaledImage2 = myImage.scaled(toSize: CGSize(width, height)### Rotating
With this extension you can rotate, flip or reflect an image.
let reflectedImage = myImage.reflected()
let flippedImage = myImage.horizontallyFlipped()
let rotatedImage = myImage.rotated(degrees: 45.0)### Saving
This extension allows you to save an image at a specified path or file URL among these format : **BMP**, **GIF**, **JPG**, **PNG**, **TIFF**.
let success = myImage.save(to: yourURL)
let success = myImage.save(toPath: yourPath, type: .jpg)### Operator overloading
You can combine images using the `+` operator, it's a top composition.
let combinedImage = img1 + img2
### Creating a gradient image
let gradient = UIImage.makeGrayGradient(width: width, height: height, fromAlpha: 1.0, toAlpha: 1.0)
### Creating an image from a string
let stringImage = UIImage.makeFromString("SwiftyImages", font: textFont, fontColor: fontColor, backgroundColor: bgColor, maxSize: maxSize)
## UIColor extensions
Some utilities to create color from a hexadecimal value, invert a color and more.
## CGContext extensions
3 functions to easily get a bitmap context :
let bmContext = CGContext.ARGBBitmapContext(width: width, height: height, withAlpha: false)
let bmContext = CGContext.RGBABitmapContext(width: width, height: height, withAlpha: true)
let bmContext = CGContext.GrayBitmapContext(width: width, height: height)## Classes
### NYXProgressiveImageView
This is a subclass of *UIImageView* to load asynchronously an image from an URL and display it as it is being downloaded. Image caching is supported.
For more informations see and .### KawaiiColors
Class to match colors like iTunes 11.
let analyzer = KawaiiColors(image: myImage)
analyzer.analyze()
//analyzer.edgeColor
//analyzer.dominantColor
//analyzer.primaryColor
//analyzer.secondaryColor
//analyzer.thirdColor### LICENSE
**SwiftyImages** is released under the MIT License, see LICENSE file.