GPU-based media processing library using Metal written in Swift. #Overview MetalAcc is a GPU-Based media processing library that lets you apply GPU-accelerated filters to images.
This library is highly insperad by famous library GPUImage. Basically following the interface of GPUImage, but using Metal and Swift, Apple's new graphics and compute application programming interface and programing language.
This library is currently under programing.And more filters will be adding soon. #Requirements
Device Name | GPU |
---|---|
iPhone 6s | Apple A9 GPU |
iPhone 6s Plus | Apple A9 GPU |
iPhone 6 | Apple A8 GPU |
iPhone 6 Plus | Apple A8 GPU |
iPhone 5s | Apple A7 GPU |
iPad Pro Wi-Fi | Apple A9 GPU |
iPad Pro Wi-Fi + Cellular | Apple A9 GPU |
iPad Air 2 Wi-Fi | Apple A8 GPU |
iPad Air 2 Wi-Fi + Cellular | Apple A8 GPU |
iPad Air Wi-Fi | Apple A7 GPU |
iPad Air Wi-Fi + Cellular | Apple A7 GPU |
iPad mini 4 Wi-Fi | Apple A8 GPU |
iPad mini 4 Wi-Fi + Cellular | Apple A8 GPU |
iPad mini 3 Wi-Fi | Apple A7 GPU |
iPad mini 3 Wi-Fi + Cellular | Apple A7 GPU |
iPad mini 2 Wi-Fi | Apple A7 GPU |
iPad mini 2 Wi-Fi + Cellular | Apple A7 GPU |
iPod Touch (6th generation) | Apple A8 GPU |
#Instructions ##Using Image filter
//create AccImage
let accImage = AccImage()
//Input resource
accImage.Input(inimage)
//Add filter
accImage.AddProcessor(AccBrightnessFilter())
//Processing
accImage.Processing()
//Output
let outimage = accImage.Output()
Color adjustments
-
AccBrightnessFilter: Adjusts the brightness of the image
- brightness: The adjusted brightness (-1.0 ~ 1.0, with 0.0 as the default)
-
AccExposureFilter: Adjusts the exposure of the image
- exposure: The adjusted exposure (-10.0 ~ 10.0, with 0.0 as the default)
-
AccContrastFilter: Adjusts the contrast of the image
- contrast: The adjusted contrast (0.0 ~ 4.0, with 1.0 as the default)
-
AccSaturationFilter: Adjusts the saturation of an image
- saturation: The degree of saturation or desaturation to apply to the image (0.0 ~ 2.0, with 1.0 as the default)
-
AccGammaFilter: Adjusts the gamma of an image
- gamma: The gamma adjustment to apply (0.0 ~ 3.0, with 1.0 as the default)
-
AccLevelsFilter: Photoshop-like levels adjustment. The min, max, minOut and maxOut parameters are floats in the range [0, 1]. If you have parameters from Photoshop in the range [0, 255] you must first convert them to be [0, 1]. The gamma/mid parameter is a float >= 0. This matches the value from Photoshop. If you want to apply levels to RGB as well as individual channels you need to use this filter twice - first for the individual channels and then for all channels.
-
AccColorMatrixFilter: Transforms the colors of an image by applying a matrix to them
- colorMatrix: A 4x4 matrix used to transform each color in an image
- intensity: The degree to which the new transformed color replaces the original color for each pixel
-
AccRGBFilter: Adjusts the individual RGB channels of an image
- red,green,blue: Normalized values by which each color channel is multiplied. The range is from 0.0 up, with 1.0 as the default.
-
AccHueFilter: Adjusts the hue of an image
- hue: The hue angle, in degrees. 90 degrees by default
- AccWhiteBalanceFilter: Adjusts the white balance of an image.
- temperature: The temperature to adjust the image by, in ºK. A value of 4000 is very cool and 7000 very warm. The default value is 5000. Note that the scale between 4000 and 5000 is nearly as visually significant as that between 5000 and 7000.
- tint: The tint to adjust the image by. A value of -200 is very green and 200 is very pink. The default value is 0.
- AccHighlightShadowFilter: Adjusts the shadows and highlights of an image
- shadows: Increase to lighten shadows, from 0.0 to 1.0, with 0.0 as the default.
- highlights: Decrease to darken highlights, from 1.0 to 0.0, with 1.0 as the default.
-
AccColorInvertFilter: Inverts the colors of an image
-
AccGrayscaleFilter: Converts an image to grayscale (a slightly faster implementation of the saturation filter, without the ability to vary the color contribution)
-
AccMonochromeFilter: Converts the image to a single-color version, based on the luminance of each pixel
- intensity: The degree to which the specific color replaces the normal image color (0.0 - 1.0, with 1.0 as the default)
- color: The color to use as the basis for the effect, with (0.6, 0.45, 0.3, 1.0) as the default.
-
AccFalseColorFilter: Uses the luminance of the image to mix between two user-specified colors
- firstColor: The first and second colors specify what colors replace the dark and light areas of the image, respectively. The defaults are (0.0, 0.0, 0.5) amd (1.0, 0.0, 0.0).
- secondColor:
-
AccHazeFilter: Used to add or remove haze (similar to a UV filter)
- distance: Strength of the color applied. Default 0. Values between -.3 and .3 are best.
- slope: Amount of color change. Default 0. Values between -.3 and .3 are best.
-
AccSepiaFilter: Simple sepia tone filter
- intensity: The degree to which the sepia tone replaces the normal image color (0.0 - 1.0, with 1.0 as the default)
-
AccOpacityFilter: Adjusts the alpha channel of the incoming image
- opacity: The value to multiply the incoming alpha channel for each pixel by (0.0 - 1.0, with 1.0 as the default)
-
AccSolidColorGenerator: This outputs a generated image with a solid color. You need to define the image size using -forceProcessingAtSize:
- color: The color, in a four component format, that is used to fill the image.
-
AccLuminanceThresholdFilter: Pixels with a luminance above the threshold will appear white, and those below will be black
- threshold: The luminance threshold, from 0.0 to 1.0, with a default of 0.5
-
AccLuminanceRangeFilter: Pixels with a luminance above the threshold will appear white, and those below will be black
- rangeReduction: The degree to reduce the luminance range, from 0.0 to 1.0. Default is 0.6.
- AccChromaKeyFilter: For a given color in the image, sets the alpha channel to 0. This is similar to the AccChromaKeyBlendFilter, only instead of blending in a second image for a matching color this doesn't take in a second image and just turns a given color transparent.
- thresholdSensitivity: How close a color match needs to exist to the target color to be replaced (default of 0.4)
- smoothing: How smoothly to blend for the color match (default of 0.1)
Image processing
- AccTransformFilter: This applies an arbitrary 2-D transformation to an image
- affineTransform: This takes in a CGAffineTransform to adjust an image in 2-D
#License MetalAcc is released under the MIT license. See LICENSE for details.