Safe Rust bindings for Apple's CoreImage framework — GPU-accelerated image processing, filtering, rendering, detection, and kernel work on macOS.
Status: v0.2.2 closes every non-exempt gap in the Core Image header audit: 466/466 verified public symbols (100%), with 33 exempt umbrella/deprecated/helper symbols. This release adds the long-tail
CIFilterBuiltinsfamilies, typedCIFilter/CIFilterGenerator/CIImageProvider/CISamplerconstant families,CIFilterConstructor,CIPlugIn/CIPlugInRegistration, a sharedCIKernelhandle, and typedCIImageProcessorinvocation snapshots.
CIImageconstructors from file paths, encoded bytes,CGImage,CVPixelBuffer,IOSurface, colors, and typed bitmap buffers viaCIFormat/CIColorSpaceCIFilterregistry/localization helpers plus typed setters, typed apply/attribute/category/input/output/UI constants, and 157 typedCIFilterBuiltinsconstructors infilters, plus family helpers for abstract builtin protocolsCIContextcreation for default, CPU, and optional Metal backends, plusCGImagerendering, bitmap-backedCIRenderDestination/CIRenderTask, and PNG/JPEG/HEIF/HEIF10/TIFF/OpenEXR export helpersCIFilterShape,CIImageAccumulator, andCIRAWFilterwrappers for shape math, incremental rendering, and RAW decoding workflows- Detector + feature inspection coverage for faces, rectangles, QR codes, and text via
CIDetector/CIFeature CIColor,CIVector,CIBarcodeDescriptor,CISampler,CIFilterGenerator,CIFilterConstructor,CIPlugIn, andCIImageProcessorwrappers for graph-building, registration, and plug-in workflowsCIColorKernel,CIWarpKernel,CIBlendKernel, andCIKernelsupport, plus shared CoreFoundation/CoreGraphics/CoreVideo/IOSurface interop viaapple-cf
use coreimage::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let red = CIColor::rgba(1.0, 0.0, 0.0, 1.0);
let source = filters::constant_color(100, 100, &red)
.ok_or("failed to create constant-color image")?;
let blurred = filters::gaussian_blur(&source, 10.0)
.ok_or("failed to blur image")?
.cropped_to(CGRect::new(0.0, 0.0, 100.0, 100.0));
let context = CIContext::new_default();
let rendered = context.render_to_cg_image(&blurred)?;
assert_eq!(rendered.width(), 100);
assert_eq!(rendered.height(), 100);
context.write_png(&blurred, "target/coreimage_demo.png")?;
Ok(())
}CIImage+ typed constants: loading, color/bitmap creation withCIFormat/CIColorSpace, geometric transforms, compositing, blur, gain-map/headroom helpers, and region-of-interest inspectionCIFilter+filters: filter discovery, localization, metadata, typed apply/attribute/category/input/output/UI constants, barcode-descriptor inputs, 157 instantiable built-in constructors, and helpers for abstract builtin familiesCIContext+CIRenderDestination/CIRenderTask: default/CPU/Metal contexts, rendering toCGImage/CVPixelBuffer/IOSurface/bitmap destinations, cache management, async render-task helpers, and file outputCIFilterShape+CIImageAccumulator: shape transforms/intersections and incremental image accumulationCIRAWFilter: supported camera-model/decoder discovery plus preview/output image access and common RAW adjustmentsCIDetector+CIFeature: detector construction plus QR/face/rectangle/text feature inspection, message strings, symbol descriptors, and sub-featuresCIColor+CIVector: structured value wrappers for graph inputs, geometry, and transform round-trippingCIBarcodeDescriptor: QR/Aztec/PDF417/Data Matrix descriptor construction and inspectionCIColorKernel,CIWarpKernel,CIBlendKernel,CIKernel: custom kernel compilation, built-in blend kernels, and shared kernel handlesCIImageProcessor: passthrough processor bridge with typedCIImageProcessorInput/CIImageProcessorOutputinvocation snapshotsCIFilterGenerator,CIFilterConstructor,CIPlugIn,CISampler: graph composition/export helpers, custom filter registration, plug-in loading, exported-key constants, and sampler configuration
The crate ships runnable examples for each major area:
01_smoke02_image03_filter04_context05_detector06_color07_vector08_kernel09_barcode_descriptor10_image_processor11_feature12_filter_generator13_sampler14_accumulator15_render_destination16_raw_filter
Run them all with:
for ex in examples/*.rs; do cargo run --example "$(basename "$ex" .rs)"; doneSee COVERAGE.md for the framework-header audit, current 466/466 non-exempt symbol coverage (100%, 33 exempt), and notes on follow-up ergonomic work such as direct image-provider callbacks or CIKernelMetalLib helpers.
-
CIImage,CIFilter,CIContext,CIVector,CIColor -
CIDetector,CIFeature, QR feature/message inspection -
CIBarcodeDescriptor,CISampler,CIFilterGenerator,CIImageProcessor - Core kernel coverage (
CIColorKernel,CIWarpKernel,CIBlendKernel,CIKernel) - Builtin filter constructors + typed constant families (
CIFormat,CIColorSpace, filter/input/output/apply/UI/exported/image-provider/sampler keys) -
CIFilterShape,CIImageAccumulator,CIRAWFilter,CIRenderDestination,CIRenderTask -
CIPlugIn,CIPlugInRegistration,CIFilterConstructor - Complete non-exempt public-symbol header audit (466/466)
- Optional future ergonomic expansions (
CIImageProvidercallback bridge,CIKernelMetalLibhelpers, additional convenience APIs)
Licensed under either of Apache-2.0 or MIT at your option.