← All @molecule/* packages · App templates
@molecule/api-image-sharpProvider bond · image · API (Node) · v1.0.1 · Apache-2.0
Sharp image processing provider for molecule.dev
npm install @molecule/api-image-sharpnpm · Source on GitHub · Implements @molecule/api-image
@molecule/api-image-sharp is a provider bond on the API (Node) side: it implements the image core interface (@molecule/api-image) with a concrete vendor or library behind it.
Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.
import { setProvider } from '@molecule/api-image'
import { provider } from '@molecule/api-image-sharp'
setProvider(provider)Works with: @molecule/api-image
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Sharp image provider for molecule.dev.
High-performance, native image processing powered by libvips via Sharp. Supports resize, crop, format conversion, thumbnailing, optimization, rotation, flip, and flop operations.
import { setProvider } from '@molecule/api-image'
import { provider } from '@molecule/api-image-sharp'
setProvider(provider)
provider
npm install @molecule/api-image-sharp @molecule/api-image sharp
SharpConfigConfiguration options for the Sharp image provider.
interface SharpConfig {
/** Default JPEG quality (1–100). Defaults to `80`. */
defaultJpegQuality?: number
/** Default PNG compression level (0–9). Defaults to `6`. */
defaultPngCompression?: number
/** Default WebP quality (1–100). Defaults to `80`. */
defaultWebpQuality?: number
/** Default AVIF quality (1–100). Defaults to `50`. */
defaultAvifQuality?: number
/** Whether to use progressive encoding for JPEG by default. Defaults to `false`. */
progressive?: boolean
/** Whether to strip metadata by default. Defaults to `true`. */
stripMetadata?: boolean
/** Limit the number of pixels to process (width × height). Defaults to `268402689` (Sharp default). */
limitInputPixels?: number | false
}
createProvider(config)Creates a Sharp-backed image provider.
function createProvider(config?: SharpConfig): ImageProvider
config — Optional provider configuration (default quality, strip metadata, etc.).Returns: An ImageProvider backed by Sharp.
providerThe provider implementation, lazily initialized with default config.
const provider: ImageProvider
Implements @molecule/api-image interface.
Setup function to register this provider with the core interface:
import { setProvider } from '@molecule/api-image'
import { provider } from '@molecule/api-image-sharp'
export function setupImageSharp(): void {
setProvider(provider)
}
Peer dependencies:
@molecule/api-image ^1.0.1@molecule/api-imagesharpIntegration checklist — drive the real UI (live preview, no mocks), adapt each item to this app's actual screens/flows, and check every box off one by one. A box you can't check is an integration bug to fix — not a skip: