Is it possible to resize image using CIFilter? I know CILanczosScaleTransform
, but it resizes image maintaining proportions. And I need to resize image without maintaining proportions. How to do that?
Asked
Active
Viewed 4,527 times
0

hockeyman
- 1,141
- 6
- 27
- 57
-
http://gigliwood.com/weblog/Cocoa/Core_Image,_part_2.html – Pravitha V Aug 13 '12 at 10:33
-
i think without maintaining proportions, best is to use http://stackoverflow.com/questions/4394491/how-to-compress-resize-image-on-iphone-os-sdk-before-uploading-to-a-server – Paresh Navadiya Aug 13 '12 at 10:47
-
@NightFURy Your suggested solution is about resizing image maintaining proportions – hockeyman Aug 13 '12 at 11:27
-
@Prince Your suggested solution is about resizing image on iOS – hockeyman Aug 13 '12 at 11:27
3 Answers
4
Why do you think CILanczosScaleTransform
maintains proportions?
CILanczosScaleTransform has a parameter @"inputAspectRatio
" or kCIInputAspectRatioKey
which allows you to scale and change the proportions. You can do it with
[filter setValue:[NSNumber numberWithFloat:0.7] forKey:@"inputAspectRatio"];
I took this from documents and didn't try it myself but am sure (due to my experiments with CIFilter) it works.

Heinrich Giesen
- 1,765
- 1
- 11
- 8
-
Note that `CILanczosScaleTransform` sets the output _height_ according to the `kCIInputScaleKey`. The output width is the input width multiplied by `kCIInputScaleKey*kCIInputAspectRatioKey`. – Nestor Sep 15 '18 at 18:38
2
Use CIAffineTransform instead of CILanczosScaleTransform. Set a and d to your desired scale values. This will shrink or stretch your image to any proposition.

Ping-Wen Ong
- 21
- 2
0
All CIFilter is below. I suppose there is no filter to resize image.
- 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

Feel Physics
- 2,783
- 4
- 25
- 38
-
Can you explain how you created this list? I tried NSLog(@"filterNamesInCategories %@", [CIFilter filterNamesInCategories:nil] ); and got much more filters. One of them was CILanczosScaleTransform which scales images. – Heinrich Giesen Aug 13 '12 at 15:43
-
This looks incomplete, or at least out of date. In iOS 6 there are 93 filters. – Ron Aug 13 '13 at 15:39
-
CILanczosScaleTransform available on OS X only. Not in iOS. He might have listed out from iOS. – rakeshNS Dec 07 '14 at 17:43