为什么你认为CILanczosScaleTransform
保持比例?
CILanczosScaleTransform有一个参数@“inputAspectRatio
”或kCIInputAspectRatioKey
,允许您缩放和来更改比例。你可以用
来做
[filter setValue:[NSNumber numberWithFloat:0.7] forKey:@"inputAspectRatio"];
我是从文件中拿出来的,并没有亲自尝试,但我确信(由于我使用CIFilter进行实验)它可以正常工作。
使用CIAffineTransform而不是CILanczosScaleTransform。将a和d设置为所需的比例值。这会将您的图像缩小或拉伸到任何命题。
所有CIFilter都在下面。我想没有用于调整图像大小的过滤器。
- CIAdditionCompositing
- CIAffineTransform
- CICheckerboardGenerator
- CIColorBlendMode
- CIColorBurnBlendMode
- CIColorControls
- CIColorCube
- CIColorDodgeBlendMode
- CIColorInvert
- CIColorMatrix
- CIColorMonochrome
- CIConstantColorGenerator
- CICrop
- CIDarkenBlendMode
- CIDifferenceBlendMode
- CIExclusionBlendMode
- CIExposureAdjust
- CIFalseColor
- CIGammaAdjust
- CIGaussianGradient
- CIHardLightBlendMode
- CIHighlightShadowAdjust
- CIHueAdjust
- CIHueBlendMode
- CILightenBlendMode
- CILinearGradient
- CILuminosityBlendMode
- CIMaximumCompositing
- CIMinimumCompositing
- CIMultiplyBlendMode
- CIMultiplyCompositing
- CIOverlayBlendMode
- CIRadialGradient
- CISaturationBlendMode
- CIScreenBlendMode
- CISepiaTone
- CISoftLightBlendMode
- CISourceAtopCompositing
- CISourceInCompositing
- CISourceOutCompositing
- CISourceOverCompositing
- CIStraightenFilter
- CIStripesGenerator
- CITemperatureAndTint
- CIToneCurve
- CIVibrance
- CIVignette
- CIWhitePointAdjust