使用CoreImage教程CoreImage包含有很多实用的滤镜,专业处理图片的库
2017-02-08 11:06
1036 查看
转自:http://www.cnblogs.com/YouXianMing/p/3719056.html
使用CoreImage教程
CoreImage包含有很多实用的滤镜,专业处理图片的库,为了能看到各种渲染效果,请使用如下图片素材.
现在可以开始教程了:
代码片段
代码片段
效果如下:
我们对操作进行简易的封装:
CIFilterEffect.h + CIFilterEffect.m
我们来开始尝试其他的滤镜效果,我们可以尝试的至少有这些:
@"CILinearToSRGBToneCurve",
@"CIPhotoEffectChrome",
@"CIPhotoEffectFade",
@"CIPhotoEffectInstant",
@"CIPhotoEffectMono",
@"CIPhotoEffectNoir",
@"CIPhotoEffectProcess",
@"CIPhotoEffectTonal",
@"CIPhotoEffectTransfer",
@"CISRGBToneCurveToLinear",
@"CIVignetteEffect",
下面是所有渲染出来的图片,与上面提供的滤镜名字一一对应:
以下效果是需要进行一些配置才能达到的效果,这个就不开源了,你懂得:).
福利:
Core Image Filter Reference
https://developer.apple.com/library/ios/documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html
标签: iOS
使用CoreImage教程
CoreImage包含有很多实用的滤镜,专业处理图片的库,为了能看到各种渲染效果,请使用如下图片素材.
现在可以开始教程了:
代码片段
代码片段
效果如下:
我们对操作进行简易的封装:
CIFilterEffect.h + CIFilterEffect.m
// // CIFilterEffect.h // CIFilter // // Created by YouXianMing on 14-5-9. // Copyright (c) 2014年 Y.X. All rights reserved. // #import <Foundation/Foundation.h> @interface CIFilterEffect : NSObject @property (nonatomic, strong, readonly) UIImage *result; - (instancetype)initWithImage:(UIImage *)image filterName:(NSString *)name; @end
// // CIFilterEffect.m // CIFilter // // Created by YouXianMing on 14-5-9. // Copyright (c) 2014年 Y.X. All rights reserved. // #import "CIFilterEffect.h" @interface CIFilterEffect () @property (nonatomic, strong, readwrite) UIImage *result; @end @implementation CIFilterEffect - (instancetype)initWithImage:(UIImage *)image filterName:(NSString *)name { self = [super init]; if (self) { // 将UIImage转换成CIImage CIImage *ciImage = [[CIImage alloc] initWithImage:image]; // 创建滤镜 CIFilter *filter = [CIFilter filterWithName:name keysAndValues:kCIInputImageKey, ciImage, nil]; [filter setDefaults]; // 获取绘制上下文 CIContext *context = [CIContext contextWithOptions:nil]; // 渲染并输出CIImage CIImage *outputImage = [filter outputImage]; // 创建CGImage句柄 CGImageRef cgImage = [context createCGImage:outputImage fromRect:[outputImage extent]]; _result = [UIImage imageWithCGImage:cgImage]; // 释放CGImage句柄 CGImageRelease(cgImage); } return self; } @end
我们来开始尝试其他的滤镜效果,我们可以尝试的至少有这些:
@"CILinearToSRGBToneCurve",
@"CIPhotoEffectChrome",
@"CIPhotoEffectFade",
@"CIPhotoEffectInstant",
@"CIPhotoEffectMono",
@"CIPhotoEffectNoir",
@"CIPhotoEffectProcess",
@"CIPhotoEffectTonal",
@"CIPhotoEffectTransfer",
@"CISRGBToneCurveToLinear",
@"CIVignetteEffect",
下面是所有渲染出来的图片,与上面提供的滤镜名字一一对应:
以下效果是需要进行一些配置才能达到的效果,这个就不开源了,你懂得:).
福利:
Core Image Filter Reference
https://developer.apple.com/library/ios/documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html
CICategoryBlur
CIBoxBlur
CIDiscBlur
CIGaussianBlur
CIMedianFilter
CIMotionBlur
CINoiseReduction
CIZoomBlur
CICategoryColorAdjustment
CIColorClamp
CIColorControls
CIColorMatrix
CIColorPolynomial
CIExposureAdjust
CIGammaAdjust
CIHueAdjust
CILinearToSRGBToneCurve
CISRGBToneCurveToLinear
CITemperatureAndTint
CIToneCurve
CIVibrance
CIWhitePointAdjust
CICategoryColorEffect(我们刚刚用到的一些效果在这里哦)
CIColorCrossPolynomial
CIColorCube
CIColorCubeWithColorSpace
CIColorInvert
CIColorMap
CIColorMonochrome
CIColorPosterize
CIFalseColor
CIMaskToAlpha
CIMaximumComponent
CIMinimumComponent
CIPhotoEffectChrome
CIPhotoEffectFade
CIPhotoEffectInstant
CIPhotoEffectMono
CIPhotoEffectNoir
CIPhotoEffectProcess
CIPhotoEffectTonal
CIPhotoEffectTransfer
CISepiaTone
CIVignette
CIVignetteEffect
CICategoryCompositeOperation
CIAdditionCompositing
CIColorBlendMode
CIColorBurnBlendMode
CIColorDodgeBlendMode
CIDarkenBlendMode
CIDifferenceBlendMode
CIExclusionBlendMode
CIHardLightBlendMode
CIHueBlendMode
CILightenBlendMode
CILuminosityBlendMode
CIMaximumCompositing
CIMinimumCompositing
CIMultiplyBlendMode
CIMultiplyCompositing
CIOverlayBlendMode
CISaturationBlendMode
CIScreenBlendMode
CISoftLightBlendMode
CISourceAtopCompositing
CISourceInCompositing
CISourceOutCompositing
CISourceOverCompositing
CICategoryDistortionEffect
CIBumpDistortion
CIBumpDistortionLinear
CICircleSplashDistortion
CICircularWrap
CIDroste
CIDisplacementDistortion
CIGlassDistortion
CIGlassLozenge
CIHoleDistortion
CILightTunnel
CIPinchDistortion
CIStretchCrop
CITorusLensDistortion
CITwirlDistortion
CIVortexDistortion
CICategoryGenerator
CICheckerboardGenerator
CIConstantColorGenerator
CILenticularHaloGenerator
CIQRCodeGenerator
CIRandomGenerator
CIStarShineGenerator
CIStripesGenerator
CISunbeamsGenerator
CICategoryGeometryAdjustment
CIAffineTransform
CICrop
CILanczosScaleTransform
CIPerspectiveTransform
CIPerspectiveTransformWithExtent
CIStraightenFilter
CICategoryGradient
CIGaussianGradient
CILinearGradient
CIRadialGradient
CISmoothLinearGradient
CICategoryHalftoneEffect
CICircularScreen
CICMYKHalftone
CIDotScreen
CIHatchedScreen
CILineScreen
CICategoryReduction
CIAreaAverage
CIAreaHistogram
CIRowAverage
CIColumnAverage
CIHistogramDisplayFilter
CIAreaMaximum
CIAreaMinimum
CIAreaMaximumAlpha
CIAreaMinimumAlpha
CICategorySharpen
CISharpenLuminance
CIUnsharpMask
CICategoryStylize
CIBlendWithAlphaMask
CIBlendWithMask
CIBloom
CIComicEffect
CIConvolution3X3
CIConvolution5X5
CIConvolution7X7
CIConvolution9Horizontal
CIConvolution9Vertical
CICrystallize
CIDepthOfField
CIEdges
CIEdgeWork
CIGloom
CIHeightFieldFromMask
CIHexagonalPixellate
CIHighlightShadowAdjust
CILineOverlay
CIPixellate
CIPointillize
CIShadedMaterial
CISpotColor
CISpotLight
CICategoryTileEffect
CIAffineClamp
CIAffineTile
CIEightfoldReflectedTile
CIFourfoldReflectedTile
CIFourfoldRotatedTile
CIFourfoldTranslatedTile
CIGlideReflectedTile
CIKaleidoscope
CIOpTile
CIParallelogramTile
CIPerspectiveTile
CISixfoldReflectedTile
CISixfoldRotatedTile
CITriangleKaleidoscope
CITriangleTile
CITwelvefoldReflectedTile
CICategoryTransition
CIBarsSwipeTransition
CICopyMachineTransition
CIDisintegrateWithMaskTransition
CIDissolveTransition
CIFlashTransition
CIModTransition
CIPageCurlTransition
CIPageCurlWithShadowTransition
CIRippleTransition
CISwipeTransition
标签: iOS
相关文章推荐
- iOS CoreImage图片处理动态渲染(滤镜)
- 【数码概念验证码识别系统教程】(三)使用滤镜处理图片
- 图像处理之CoreImage图片滤镜
- python使用Image处理图片常用技巧分析
- 图片拉伸处理:stretchableImageWithLeftCapWidth方法的使用
- iOS使用CoreImage处理图像40中可用的滤镜名称
- Filter Effects - 使用 CSS3 滤镜处理图片
- 使用ImageMagick + Jmagick进行图片操作(续2)——实现高质量的图片处理
- iOS使用CoreImage处理图像40中可用的滤镜名称
- Swift使用SDWebImage处理远程图片资源
- GPUImage教程(一)安装,使用例子, 原理和内置滤镜列表
- python使用Image处理图片常用技巧分析
- 在Python中使用PIL模块对图片进行高斯模糊处理的教程
- ImageMagick for java 使用Jmagick处理高质量图片
- CoreImage图片滤镜效果详解
- 使用System.Web.Helpers.WebImage处理图片
- 使用GPUImage渲染图片教程
- CoreImage的使用(给图片添加滤镜)
- 在Python中使用PIL模块对图片进行高斯模糊处理的教程