otf-pixels-ops 0.2.0

Operation kernels for otf-pixels.
Documentation
  • Coverage
  • 100%
    56 out of 56 items documented0 out of 0 items with examples
  • Size
  • Source code size: 259.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.0 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Open-Tech-Foundation/Pixels
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Thanga-Ganapathy

otf-pixels-ops

The image operations of Pixels

crates.io | Docs | Pixels

An Open Tech Foundation project

Each op declares its output shape and the input region it needs, and computes one tile at a time. Nothing runs when an op is chained, only when output is pulled.

[!TIP] Building an app or a server? Use otf-pixels instead: image.resize(400, 300) there is Resize here, already wired in.

Use it

Ops apply to an otf-pixels-core Image:

use std::sync::Arc;
use otf_pixels_core::{Image, Result};
use otf_pixels_ops::{Fit, Modulate, Resize, ResizeOptions};

fn thumbnail(image: &Image) -> Result<Image> {
    let options = ResizeOptions::default().with_fit(Fit::Cover);
    image
        .apply(Arc::new(Resize::new(400, 300, options)?))?
        .apply(Arc::new(Modulate::identity().with_saturation(0.0)?))
}

API

Op What it does
Resize, ResizeOptions, Fit, Filter Resample with seven filters and fit modes
Crop, Flip, Flop, Rotate, Quarter Geometry: windows, mirrors, quarter turns
Modulate Brightness, saturation and hue
Convolve, Kernel Blur, sharpen and custom kernels
Composite, Blend Overlay one image on another
ExtractChannel, Flatten Pick a channel; flatten alpha onto a colour
ConvertFormat Change pixel format (bit depth, channels)
ToSrgb, Conversion ICC profile to sRGB

Part of Pixels

Crate Role
otf-pixels The chainable Image API most users want
otf-pixels-core Graph, tiles, scheduler, codec and op traits
otf-pixels-ops Image operations
otf-pixels-compress DEFLATE, zlib, LZW, checksums
otf-pixels-codec-* One crate per format

License

Apache-2.0 — see LICENSE.