API Reference image_plug v#0.1.0

Copy Markdown View Source

Modules

The library's request entry point.

HTTP admin surface for variant CRUD.

HTTP-cache helpers used by Image.Plug.

Probes the local libvips build for optional encoder capabilities.

Tagged error type returned by every public function in Image.Plug.

Face-aware crop, zoom, and pixelation, gated on the optional :image_vision dependency.

Validated, frozen configuration for Image.Plug.

The canonical, provider-neutral image-processing pipeline.

Serialises a transformed Vix.Vips.Image into bytes for the HTTP response.

Executes a normalised pipeline against an open Vix.Vips.Image.

Reorders, folds, and validates a pipeline so that two requests with the same semantic effect produce identical fingerprints — and so that order-sensitive libvips operations land in a position where they actually work.

Tonal/colour adjustment operation. A consolidated bag of multiplier fields so that adjacent adjustments fold into one op during normalisation.

Background fill operation. Flattens any transparency in the working image against the given solid colour.

Gaussian blur operation. Holds a libvips sigma value derived from the provider's native blur parameter (Cloudflare uses 0..250).

Border operation. Adds a coloured border of the given per-side widths around the working image by embedding it in a larger canvas of the border colour.

Convert the image to a different colorspace.

Crop operation. Extracts a sub-rectangle of the working image.

Overlay/watermark operation. Wraps an ordered list of Image.Plug.Pipeline.Ops.Draw.Layer structs.

Drop-shadow operation. The shadow is the source's alpha silhouette, blurred, tinted, scaled by :opacity, and composited beneath the original at (:dx, :dy). Maps to ImageKit's e-shadow=... parameter family.

Content-aware automatic enhancement. Maps to imgix's auto=enhance, Cloudinary's e_improve family (e_improve, e_auto_brightness, e_auto_color, e_auto_contrast), and ImageKit's e-retouch.

Alpha-gradient fade-out on one or more edges. :edges is :all or a list drawn from :top, :bottom, :left, :right. :length is either an integer pixel count or a float fraction of the relevant dimension. Maps to Cloudinary's e_fade[:N] (N interpreted as a percentage).

Flip operation. Mirrors the working image along one or both axes.

Output format / encoder configuration. Lives on the pipeline rather than in the op list — there is exactly one per pipeline.

ICC-profile-driven colourspace conversion. Distinct from Ops.Colorspace (which uses libvips' named-interpretation modes); this op invokes Image.to_colorspace/3 and runs an actual profile-based transform.

Mid-pipeline alpha multiplier. :factor is in [0.0, 1.0]; 1.0 is a no-op (the normaliser drops the op), 0.0 produces a fully transparent image. Maps to Cloudinary's o_<n> (where n / 100 is passed) and ImageKit's e-opacity:<n>.

EXIF orientation override. :value is an integer in 1..8 per the EXIF orientation enumeration; the interpreter calls Image.set_orientation/2 to write the metadata field without rotating the underlying pixels. Maps to imgix's or=N.

Block-style pixelation. :scale is the resize factor passed to Image.pixelate/2 — smaller values produce coarser blocks (e.g. 0.05 = ~20-pixel blocks on a 400-pixel image). Maps to Cloudinary's e_pixelate[:N] where N is a block size in pixels (the provider parser converts N → scale = 1 / N).

Pixelates only the regions of an image occupied by detected faces, leaving the rest of the image untouched. Maps to Cloudinary's e_pixelate_faces[:N].

Tonal-quantisation operation. :levels in 2..256 is the number of distinct values per band. Maps to Cloudinary's e_cartoonify[:level_count] (level_count defaults to 5).

Replace one colour in the image with another, with a tolerance.

Resize operation. Combines target dimensions, fit mode, gravity (focal point for cropping), upscale policy, and DPR (device pixel ratio).

Rotation operation. Rotates the working image by angle degrees clockwise.

Rounded-corners mask operation. :radius is the corner radius in pixels. The atom :max produces a fully circular / pill-shaped result (radius = half the shorter dimension). Maps to Cloudinary's r_<n> and r_max.

Subject-segmentation placeholder operation. Cloudflare's segment=foreground isolates the subject and replaces the background with transparency.

Sepia tone operation. :strength is a [0.0, 1.0] blend factor between the identity (0.0) and the full sepia matrix (1.0). Maps to imgix's sepia=N (N / 100) and Cloudinary's e_sepia[:N] (N / 100, default full sepia).

Edge-enhancement operation. Holds a libvips sigma value derived from the provider's native sharpen parameter (Cloudflare uses 0..10).

Single-colour tinted-monochrome operation.

Trim operation. Removes border pixels from the working image.

Radial vignette darkening operation. :strength is in [0.0, 1.0] and matches Image.vignette/2's argument of the same name. Maps to Cloudinary's e_vignette[:N] (N / 100, default 0.5).

Behaviour for URL-API providers.

Cloudflare Images URL provider.

Parses the comma-separated <options> segment of a Cloudflare Images URL into a canonical Image.Plug.Pipeline.

URL-shape recognition for the Cloudflare Images URL grammar.

Cloudinary URL provider.

Cloudinary-flavoured URL signing.

Builds the IIIF Image API 3.0 Image Information document (info.json) for a given source.

Parses the four IIIF Image API 3.0 option segments (region / size / rotation / quality.format) into a canonical Image.Plug.Pipeline.

Recognises IIIF Image API 3.0 URL forms in Plug.Conn.path_info and returns a structured result the higher-level provider dispatches on.

ImageKit URL provider.

ImageKit-flavoured HMAC URL signing.

Imgix URL provider.

Parses an imgix query string into a canonical Image.Plug.Pipeline.

Imgix-flavoured HMAC URL signing.

URL-shape recognition for the imgix URL grammar.

HMAC signing and verification for Image.Plug request URLs.

Reference to a source image. Produced by a provider, consumed by a source resolver.

Behaviour for source resolvers.

Source resolver that dispatches by Image.Plug.Source.kind to a configured set of per-kind resolvers.

Source resolver that reads images from a configured root directory.

Source resolver that streams images from http(s):// URLs.

A named, stored pipeline that requests can resolve by name.

Behaviour for variant stores.

In-memory ETS-backed implementation of Image.Plug.VariantStore.

Behaviour for persisting variants across application restarts.

JSON-on-disk variant persistence backend.