image_forge_core library

Lightweight Rust image processing engine — core operations only.

For face beauty, mood filters, swipe looks, LUT, GPU preview surface, layer compositing, and temporal smoothing, see image_forge.

Classes

BatchResizeItem
Batch resize input payload.
BeautyParams
Regional beauty parameters — used by face beauty pipeline in image_forge.
DrawCircle
Vector circle coordinates and styles.
DrawLine
Vector line coordinates and styles.
EditOp
GpuComputeInfo
Diagnostics metadata about the active GPU device.
ImageFilter
ImageInfo
High-level format and EXIF info for a queried image.
ProgressiveDecodeResult
Progressive decoding results containing a fast preview and the full image buffer.
RgbaImageBuffer
Raw RGBA buffer for chained edits without re-decoding.
RustLib
Main entrypoint of the Rust API
SwipeLookExtrasDto
Post-grade extras applied during combo looks (such as overlay glow or grain).
TextOverlay
Text overlay drawing settings.

Enums

BeautyLookPreset
One-tap beauty look preset.
BlendMode
Composite blend modes.
FilterPreset
Filter presets applied globally to color grade the image.
LipTintPreset
Lip color swatch for regional tint.
MoodFilterPreset
Instagram-style mood filters (requires image_forge for implementation).
OutputFormat
The image format for output compression.
PreviewQuality
Quality vs Speed choice for interactive previews.
ProcessingBackend
Processing backend: CPU (SIMD) or GPU (Metal/Vulkan via wgpu).
ResizeAlgorithm
Image resizing algorithms, ranging from fast/nearest-neighbor to high-quality Lanczos.
Rotation
Rotations and mirror/flip transformations.
SwipeLookPreset
TikTok / Instagram combo swipe looks (requires image_forge for implementation).

Extensions

EditOpPatterns on EditOp
Adds pattern-matching-related methods to EditOp.
ImageFilterPatterns on ImageFilter
Adds pattern-matching-related methods to ImageFilter.

Functions

addWatermark({required List<int> baseBytes, required List<int> overlayBytes, required int x, required int y, required OutputFormat format, required int quality}) Uint8List
Overlays a watermark image onto a base image at the specified pixel coordinates.
applyEditPipeline({required RgbaImageBuffer buffer, required List<EditOp> ops, required ProcessingBackend backend}) RgbaImageBuffer
applyFilter({required List<int> bytes, required ImageFilter filter, required OutputFormat format, required int quality, required bool fixExif}) Uint8List
Applies a basic filter or adjustment (brightness, blur, etc.) to an image file. Studio filters (Mood, SwipeLook, LutPng, SkinSmooth, Beauty) return an error when called without the image_forge package.
batchResizeImages({required List<BatchResizeItem> items, required ResizeAlgorithm algorithm, required OutputFormat format, required int quality, required ProcessingBackend backend}) List<Uint8List>
Resizes multiple images concurrently in parallel (using rayon).
bufferPoolAcquire({required int minCapacity}) Uint8List
Rents or acquires a Vec<u8> from the pool with at least min_capacity to prevent allocations (Phase 3).
bufferPoolRelease({required List<int> buf}) → void
Releases a buffer (such as a rented Vec<u8>) back to the buffer pool (Phase 3).
bufferPoolStats() → (BigInt, BigInt)
Returns the current statistics of the buffer pool (count of buffers, total size in bytes).
compressImage({required List<int> bytes, required OutputFormat format, required int quality}) Uint8List
Re-compresses an image file with a specified quality and output format.
createThumbnail({required List<int> bytes, required int maxEdge, required OutputFormat format, required int quality, required ResizeAlgorithm algorithm, required bool fixExif, required ProcessingBackend backend}) Uint8List
Creates a fast thumbnail for an image. Fits the image within max_edge bounding box.
cropImage({required List<int> bytes, required int x, required int y, required int width, required int height, required OutputFormat format, required int quality, required bool fixExif}) Uint8List
Crops a rectangular area of an image file.
cropRgbaBuffer({required RgbaImageBuffer buffer, required int x, required int y, required int width, required int height}) RgbaImageBuffer
Crops a rectangular region of a raw RGBA buffer.
decodeBlurhash({required String hash, required int width, required int height, required OutputFormat format, required int quality}) Uint8List
Decodes a BlurHash string back into compressed image bytes.
decodeProgressiveImage({required List<int> bytes, required int previewMaxEdge, required bool fixExif}) ProgressiveDecodeResult
Performs progressive decoding of image bytes, yielding both a low-res preview and a full buffer.
decodeToRgbaBuffer({required List<int> bytes, required bool fixExif, int? maxEdge}) RgbaImageBuffer
Decodes an image file (JPEG, PNG, etc.) to raw 32-bit RGBA pixel buffers.
drawCircleOnImage({required List<int> bytes, required DrawCircle circle, required OutputFormat format, required int quality, required bool fixExif}) Uint8List
Draws a vector circle directly onto the image.
drawCircleRgbaBuffer({required RgbaImageBuffer buffer, required DrawCircle circle}) RgbaImageBuffer
Draws a vector circle onto a raw RGBA buffer.
drawLineOnImage({required List<int> bytes, required DrawLine line, required OutputFormat format, required int quality, required bool fixExif}) Uint8List
Draws a vector line directly onto the image.
drawLineRgbaBuffer({required RgbaImageBuffer buffer, required DrawLine line}) RgbaImageBuffer
Draws a vector line onto a raw RGBA buffer.
drawTextOnImage({required List<int> bytes, required TextOverlay overlay, required OutputFormat format, required int quality, required bool fixExif}) Uint8List
Renders a single line of text directly onto the image.
drawTextRgbaBuffer({required RgbaImageBuffer buffer, required TextOverlay overlay}) RgbaImageBuffer
Draws text onto a raw RGBA buffer.
dummyForCodegenExtras({required SwipeLookExtrasDto a, required BeautyLookPreset b}) → void
Dummy function to force the code generator to expose BeautyLookPreset and SwipeLookExtrasDto
encodeBlurhash({required List<int> bytes, required int componentsX, required int componentsY}) String
Computes a BlurHash string from raw image bytes.
encodeRgbaBuffer({required RgbaImageBuffer buffer, required OutputFormat format, required int quality}) Uint8List
Encodes a raw RGBA buffer into compressed image bytes (such as JPEG/PNG).
encodeRgbaPreviewBuffer({required RgbaImageBuffer buffer, required int maxEdge, required int quality, required PreviewQuality previewQuality}) Uint8List
Encodes an RGBA buffer to preview JPEG bytes, optimized for performance over visual quality.
filterExecutionPathName({required ImageFilter filter, required ProcessingBackend backend}) String
Returns a string identifier for the filter execution path (e.g. "gpu_adjust" or "cpu_photon").
filterRgbaBuffer({required RgbaImageBuffer buffer, required ImageFilter filter, required ProcessingBackend backend}) RgbaImageBuffer
Applies a filter preset or adjustment (brightness/blur etc.) to a raw RGBA buffer.
fitMaxEdgeRgbaBuffer({required RgbaImageBuffer buffer, required int maxEdge, required PreviewQuality previewQuality}) RgbaImageBuffer
Resizes a raw RGBA buffer so its longest side fits within max_edge.
fixExifOrientation({required List<int> bytes, required OutputFormat format, required int quality}) Uint8List
Rewrites the image file so that pixels match the physical EXIF orientation, clearing the EXIF tag.
gpuComputeInfo() GpuComputeInfo
Retrieves metadata about the active GPU device and compute API (Metal/Vulkan etc.).
isGpuComputeAvailable() bool
Returns true if GPU compute capability is supported on the current platform/device.
overlayImage({required List<int> baseBytes, required List<int> overlayBytes, required int x, required int y, required BlendMode blendMode, required OutputFormat format, required int quality}) Uint8List
Composites an overlay image onto a base image using standard blend modes.
overlayOnRgbaBuffer({required RgbaImageBuffer base, required List<int> overlayBytes, required int x, required int y, required BlendMode blendMode, required int overlayWidth, required int overlayHeight}) RgbaImageBuffer
Composites raw overlay pixels onto a base RGBA buffer at the specified position.
probeImage({required List<int> bytes}) ImageInfo
Probes an image file to extract dimensions, format, and EXIF orientation without decoding full pixels.
processingBackendName({required ProcessingBackend backend}) String
Returns a string representation of the active processing backend.
readExifOrientation({required List<int> bytes}) int?
Reads the raw EXIF orientation value from the image metadata.
resizeImage({required List<int> bytes, required int width, required int height, required ResizeAlgorithm algorithm, required OutputFormat format, required int quality, required bool fixExif, required ProcessingBackend backend}) Uint8List
Resizes an image file and encodes the result in the specified format and quality.
resizeRgbaBuffer({required RgbaImageBuffer buffer, required int width, required int height, required ResizeAlgorithm algorithm, required ProcessingBackend backend}) RgbaImageBuffer
Resizes a raw RGBA buffer using the specified algorithm (with optional GPU acceleration).
rotateImage({required List<int> bytes, required Rotation rotation, required OutputFormat format, required int quality, required bool fixExif}) Uint8List
Rotates or flips an image file.
rotateRgbaArbitrary({required RgbaImageBuffer buffer, required double degrees}) RgbaImageBuffer
Performs an arbitrary rotation (in degrees) on a raw RGBA buffer, expanding canvas size.