Skip to main content

flutter_core_image_filters 0.0.26 copy "flutter_core_image_filters: ^0.0.26" to clipboard
flutter_core_image_filters: ^0.0.26 copied to clipboard

PlatformiOSmacOS

Image filters based on CoreImage fragment with useful image and video preview widgets

Pub codecov build Star on Github License: MIT

A flutter package for iOS and MacOS for applying CoreImage filters to image.

Usage #

Export processed image #


final inputSource = AssetInputSource('demo.jpeg');
final configuration = CIPhotoEffectChromeConfiguration();
final image = await configuration.export(inputSource);

CIImagePreview example #

import 'package:flutter_core_image_filters/flutter_core_image_filters.dart';

class PreviewPage extends StatefulWidget {
  const PreviewPage({Key? key}) : super(key: key);

  @override
  State<PreviewPage> createState() => _PreviewPageState();
}

class _PreviewPageState extends State<PreviewPage> {
  late CIPhotoEffectChromeConfiguration configuration;
  late final CIImagePreviewController controller;
  bool controllerReady = false;

  @override
  void initState() {
    super.initState();
    _prepare().whenComplete(() {
      setState(() {});
    });
  }

  Future<void> _prepare() async {
    configuration = CIPhotoEffectChromeConfiguration();
    controller =
    await CIImagePreviewController.fromAsset(_assetPath);
    await configuration.prepare();
    await controller.connect(configuration);
    controllerReady = true;
  }

  @override
  void dispose() {
    controller.dispose();
    configuration.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return controllerReady
        ? CIImagePreview(controller: controller)
        : const Offstage();
  }
}

Divided preview sample #

import 'package:before_after_image_slider_nullsafty/before_after_image_slider_nullsafty.dart';
import 'package:flutter_core_image_filters/flutter_core_image_filters.dart';

class PreviewPage extends StatefulWidget {
  const PreviewPage({Key? key}) : super(key: key);

  @override
  State<PreviewPage> createState() => _PreviewPageState();
}

class _PreviewPageState extends State<PreviewPage> {
  late CIPhotoEffectChromeConfiguration configuration;
  late final CIImagePreviewController sourceController;
  late final CIImagePreviewController destinationController;
  bool controllersReady = false;

  @override
  void initState() {
    super.initState();
    _prepare().whenComplete(() {
      setState(() {});
    });
  }

  Future<void> _prepare() async {
    configuration = CIPhotoEffectChromeConfiguration();
    sourceController = await CIImagePreviewController.fromAsset('demo.jpeg');
    destinationController =
    await CIImagePreviewController.fromAsset('demo.jpeg');
    await configuration.prepare();
    await destinationController.connect(configuration);
    controllersReady = true;
  }

  @override
  void dispose() {
    sourceController.dispose();
    destinationController.dispose();
    configuration.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return controllersReady
        ? BeforeAfter(
      thumbRadius: 0.0,
      thumbColor: Colors.transparent,
      beforeImage: CIImagePreview(
        controller: sourceController,
      ),
      afterImage: CIImagePreview(
        controller: destinationController,
      ),
    )
        : const Offstage();
  }
}

Export & save processed image #

import 'package:image/image.dart' as img;
import 'package:path_provider/path_provider.dart';


final inputSource = AssetInputSource('demo.jpeg');
final configuration = CIPhotoEffectChromeConfiguration();
final image = await configuration.export(inputSource);

final directory = await

getTemporaryDirectory();

final output =
File('${directory.path}/result.jpeg');
final bytes = await
image.toByteData();

final persistedImage = img.Image.fromBytes(
  width: image.width,
  height: image.height,
  bytes: bytes!.buffer,
  numChannels: 4,
);
img.JpegEncoder encoder = img.JpegEncoder();
final data = encoder.encode(persistedImage);
await
output.writeAsBytes(data);

Additional information #

Support status of CoreImage filters #

Status Name Display Name
✅ CIAccordionFoldTransition Accordion Fold Transition
❌ CIAdditionCompositing Addition
❌ CIAffineClamp Affine Clamp
❌ CIAffineTile Affine Tile
❌ CIAffineTransform Affine Transform
✅ CIAreaAverage Area Average
✅ CIAreaHistogram Area Histogram
✅ CIAreaLogarithmicHistogram Area Logarithmic Histogram
✅ CIAreaMaximum Area Maximum
✅ CIAreaMaximumAlpha Area Maximum Alpha
✅ CIAreaMinimum Area Minimum
✅ CIAreaMinimumAlpha Area Minimum Alpha
✅ CIAreaMinMax Area Min and Max
✅ CIAreaMinMaxRed Area Min and Max Red
❌ CIAttributedTextImageGenerator Attributed Text Image Generator
❌ CIAztecCodeGenerator Aztec Code Generator
❌ CIBarcodeGenerator Barcode Generator
✅ CIBarsSwipeTransition Bars Swipe Transition
✅ CIBicubicScaleTransform Bicubic Scale Transform
❌ CIBlendWithAlphaMask Blend With Alpha Mask
✅ CIBlendWithBlueMask Blend With Blue Mask
✅ CIBlendWithMask Blend With Mask
✅ CIBlendWithRedMask Blend With Red Mask
✅ CIBloom Bloom
✅ CIBokehBlur Bokeh Blur
✅ CIBoxBlur Box Blur
✅ CIBumpDistortion Bump Distortion
✅ CIBumpDistortionLinear Bump Distortion Linear
❌ CICameraCalibrationLensCorrection Lens Correction for AVC
⁉️ CICheckerboardGenerator Checkerboard
✅ CICircleSplashDistortion Circle Splash Distortion
✅ CICircularScreen Circular Screen
✅ CICircularWrap Circular Wrap Distortion
✅ CIClamp Clamp
✅ CICMYKHalftone CMYK Halftone
❌ CICode128BarcodeGenerator Code 128 Barcode Generator
✅ CIColorAbsoluteDifference Color Absolute Difference
✅ CIColorBlendMode Color Blend Mode
✅ CIColorBurnBlendMode Color Burn Blend Mode
✅ CIColorClamp Color Clamp
✅ CIColorControls Color Controls
✅ CIColorCrossPolynomial Color Cross Polynomial
❌ CIColorCube Color Cube
❌ CIColorCubesMixedWithMask Color Cubes Mixed With Mask
❌ CIColorCubeWithColorSpace Color Cube with ColorSpace
❌ CIColorCurves Color Curves
✅ CIColorDodgeBlendMode Color Dodge Blend Mode
✅ CIColorInvert Color Invert
❌ CIColorMap Color Map
✅ CIColorMatrix Color Matrix
✅ CIColorMonochrome Color Monochrome
✅ CIColorPolynomial Color Polynomial
✅ CIColorPosterize Color Posterize
✅ CIColorThreshold Color Threshold
✅ CIColorThresholdOtsu Color Threshold Otsu
✅ CIColumnAverage Column Average
✅ CIComicEffect Comic Effect
✅ CIConstantColorGenerator Constant Color
⁉️ CIConvertLabToRGB Convert Lab to RGB
✅ CIConvertRGBtoLab Convert RGB to Lab
✅ CIConvolution3X3 3 by 3 Convolution
✅ CIConvolution5X5 5 by 5 Convolution
✅ CIConvolution7X7 7 by 7 Convolution
✅ CIConvolution9Horizontal Horizontal 9 Convolution
✅ CIConvolution9Vertical Vertical 9 Convolution
✅ CIConvolutionRGB3X3 3 by 3 RGB Convolution
✅ CIConvolutionRGB5X5 5 by 5 RGB Convolution
✅ CIConvolutionRGB7X7 7 by 7 RGB Convolution
✅ CIConvolutionRGB9Horizontal Horizontal 9 RGB Convolution
✅ CIConvolutionRGB9Vertical Vertical 9 RGB Convolution
❌ CICopyMachineTransition Copy Machine
❌ CICoreMLModelFilter CoreML Model Filter
✅ CICrop Crop
✅ CICrystallize Crystallize
❌ CIDarkenBlendMode Darken Blend Mode
❌ CIDepthBlurEffect Depth Blur Effect
✅ CIDepthOfField Depth of Field
⁉️ CIDepthToDisparity Depth To Disparity
❌ CIDifferenceBlendMode Difference Blend Mode
✅ CIDiscBlur Disc Blur
❌ CIDisintegrateWithMaskTransition Disintegrate With Mask
⁉️ CIDisparityToDepth Disparity To Depth
❌ CIDisplacementDistortion Displacement Distortion
❌ CIDissolveTransition Dissolve
✅ CIDither Dither
✅ CIDivideBlendMode Divide Blend Mode
✅ CIDocumentEnhancer Document Enhancer
✅ CIDotScreen Dot Screen
✅ CIDroste Droste
❌ CIEdgePreserveUpsampleFilter Edge Preserve Upsample Filter
✅ CIEdges Edges
✅ CIEdgeWork Edge Work
✅ CIEightfoldReflectedTile Eightfold Reflected Tile
❌ CIExclusionBlendMode Exclusion Blend Mode
✅ CIExposureAdjust Exposure Adjust
✅ CIFalseColor False Color
❌ CIFlashTransition Flash
✅ CIFourfoldReflectedTile Fourfold Reflected Tile
✅ CIFourfoldRotatedTile Fourfold Rotated Tile
❌ CIFourfoldTranslatedTile Fourfold Translated Tile
✅ CIGaborGradients Gabor Gradients
✅ CIGammaAdjust Gamma Adjust
✅ CIGaussianBlur Gaussian Blur
✅ CIGaussianGradient Gaussian Gradient
❌ CIGlassDistortion Glass Distortion
✅ CIGlassLozenge Glass Lozenge
✅ CIGlideReflectedTile Glide Reflected Tile
✅ CIGloom Gloom
❌ CIGuidedFilter Guided Filter
❌ CIHardLightBlendMode Hard Light Blend Mode
✅ CIHatchedScreen Hatched Screen
✅ CIHeightFieldFromMask Height Field From Mask
✅ CIHexagonalPixellate Hexagonal Pixelate
✅ CIHighlightShadowAdjust Highlight and Shadow Adjust
✅ CIHistogramDisplayFilter Histogram Display
✅ CIHoleDistortion Hole Distortion
✅ CIHueAdjust Hue Adjust
✅ CIHueBlendMode Hue Blend Mode
❌ CIHueSaturationValueGradient Hue/Saturation/Value Gradient
✅ CIKaleidoscope Kaleidoscope
✅ CIKeystoneCorrectionCombined Combined Keystone Correction
✅ CIKeystoneCorrectionHorizontal Horizontal Keystone Correction
✅ CIKeystoneCorrectionVertical Vertical Keystone Correction
❌ CIKMeans KMeans
❌ CILabDeltaE Lab ∆E
✅ CILanczosScaleTransform Lanczos Scale Transform
✅ CILenticularHaloGenerator Lenticular Halo
❌ CILightenBlendMode Lighten Blend Mode
✅ CILightTunnel Light Tunnel Distortion
❌ CILinearBurnBlendMode Linear Burn Blend Mode
❌ CILinearDodgeBlendMode Linear Dodge Blend Mode
✅ CILinearGradient Linear Gradient
❌ CILinearLightBlendMode Linear Light Blend Mode
✅ CILinearToSRGBToneCurve Linear to sRGB Tone Curve
✅ CILineOverlay Line Overlay
✅ CILineScreen Line Screen
❌ CILuminosityBlendMode Luminosity Blend Mode
❌ CIMaskedVariableBlur Masked Variable Blur
✅ CIMaskToAlpha Mask to Alpha
✅ CIMaximumComponent Maximum Component
❌ CIMaximumCompositing Maximum
✅ CIMedianFilter Median
❌ CIMeshGenerator Mesh Generator
✅ CIMinimumComponent Minimum Component
❌ CIMinimumCompositing Minimum
✅ CIMix Mix
✅ CIModTransition Mod
✅ CIMorphologyGradient Morphology Gradient
✅ CIMorphologyMaximum Morphology Maximum
✅ CIMorphologyMinimum Morphology Minimum
✅ CIMorphologyRectangleMaximum Morphology Rectangle Maximum
✅ CIMorphologyRectangleMinimum Morphology Rectangle Minimum
✅ CIMotionBlur Motion Blur
❌ CIMultiplyBlendMode Multiply Blend Mode
❌ CIMultiplyCompositing Multiply
✅ CINinePartStretched Nine Part Stretched
✅ CINinePartTiled Nine Part Tiled
✅ CINoiseReduction Noise Reduction
✅ CIOpTile Op Tile
✅ CIOverlayBlendMode Overlay Blend Mode
❌ CIPageCurlTransition Page Curl
✅ CIPageCurlWithShadowTransition Page Curl With Shadow
❌ CIPaletteCentroid Palette Centroid
❌ CIPalettize Palettize
✅ CIParallelogramTile Parallelogram Tile
❌ CIPDF417BarcodeGenerator PDF417 Barcode Generator
⁉️ CIPersonSegmentation Person Segmentation
✅ CIPerspectiveCorrection Perspective Correction
✅ CIPerspectiveRotate Perspective Rotate
✅ CIPerspectiveTile Perspective Tile
✅ CIPerspectiveTransform Perspective Transform
✅ CIPerspectiveTransformWithExtent Perspective Transform with Extent
✅ CIPhotoEffectChrome Photo Effect Chrome
✅ CIPhotoEffectFade Photo Effect Fade
✅ CIPhotoEffectInstant Photo Effect Instant
✅ CIPhotoEffectMono Photo Effect Mono
✅ CIPhotoEffectNoir Photo Effect Noir
✅ CIPhotoEffectProcess Photo Effect Process
✅ CIPhotoEffectTonal Photo Effect Tonal
✅ CIPhotoEffectTransfer Photo Effect Transfer
✅ CIPinchDistortion Pinch Distortion
❌ CIPinLightBlendMode Pin Light Blend Mode
✅ CIPixellate Pixelate
✅ CIPointillize Pointillize
❌ CIQRCodeGenerator QR Code Generator
✅ CIRadialGradient Radial Gradient
✅ CIRandomGenerator Random Generator
❌ CIRippleTransition Ripple
✅ CIRoundedRectangleGenerator Rounded Rectangle Generator
✅ CIRowAverage Row Average
⁉️ CISaliencyMapFilter Saliency Map Filter
✅ CISampleNearest Sample Nearest
✅ CISaturationBlendMode Saturation Blend Mode
❌ CIScreenBlendMode Screen Blend Mode
✅ CISepiaTone Sepia Tone
❌ CIShadedMaterial Shaded Material
✅ CISharpenLuminance Sharpen Luminance
✅ CISixfoldReflectedTile Sixfold Reflected Tile
✅ CISixfoldRotatedTile Sixfold Rotated Tile
✅ CISmoothLinearGradient Smooth Linear Gradient
✅ CISoftLightBlendMode Soft Light Blend Mode
❌ CISourceAtopCompositing Source Atop
❌ CISourceInCompositing Source In
❌ CISourceOutCompositing Source Out
❌ CISourceOverCompositing Source Over
✅ CISpotColor Spot Color
✅ CISpotLight Spot Light
✅ CISRGBToneCurveToLinear sRGB Tone Curve to Linear
✅ CIStarShineGenerator Star Shine
✅ CIStraightenFilter Straighten
✅ CIStretchCrop Stretch Crop
✅ CIStripesGenerator Stripes
❌ CISubtractBlendMode Subtract Blend Mode
✅ CISunbeamsGenerator Sunbeams
✅ CISwipeTransition Swipe
✅ CITemperatureAndTint Temperature and Tint
❌ CITextImageGenerator Text Image Generator
✅ CIThermal Thermal
✅ CIToneCurve Tone Curve
✅ CITorusLensDistortion Torus Lens Distortion
✅ CITriangleKaleidoscope Triangle Kaleidoscope
✅ CITriangleTile Triangle Tile
✅ CITwelvefoldReflectedTile Twelvefold Reflected Tile
✅ CITwirlDistortion Twirl Distortion
✅ CIUnsharpMask Unsharp Mask
✅ CIVibrance Vibrance
✅ CIVignette Vignette
✅ CIVignetteEffect Vignette Effect
✅ CIVividLightBlendMode Vivid Light Blend Mode
✅ CIVortexDistortion Vortex Distortion
✅ CIWhitePointAdjust White Point Adjust
✅ CIXRay X-Ray
✅ CIZoomBlur Zoom Blur

Sample results #

Photo Effect Chrome Photo Effect Fade Photo Effect Instant Photo Effect Mono Photo Effect Noir Photo Effect Process Photo Effect Tonal Photo Effect Transfer

Examples #

Maintainers #

20
likes
150
points
84
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Image filters based on CoreImage fragment with useful image and video preview widgets

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

collection, flutter, flutter_gpu_filters_interface, plugin_platform_interface

More

Packages that depend on flutter_core_image_filters

Packages that implement flutter_core_image_filters