imagetools-core

A toolbox of import directives that can transform your image at compile-time.
All of the image transformations are powered by sharp.
This package holds all transforms and core utility functions needed to integrate imagetools with any builtool,
or to create a standalone transformation server!
Table of Contents
Install
npm install imagetools-core@next
yarn add imagetools-core@next
Usage
import { loadImage, applyTransforms, builtins } from "imagetools-core"
const image = loadImage("./example.jpg")
const config = {
width: "400",
height: "300",
format: "webp"
}
const { transforms, warnings } = generateTransforms(config, builtins)
const { image: transformedImage, metadata } = await applyTransforms(transforms, image)
transformedImage
metadata
import { parseURL, resolveConfigs } from "imagetools-core"
const src = new URL('file:///example.jpg?w=300;500;700&format=webp')
const parameters = parseURL(src)
const configs = resolveConfigs(parameters)
Contributing
Feel free to dive in! Open an issue or submit PRs!
All information to get you started hacking on imagetools is in CONTRIBUTING.md!
License
MIT © Jonas Kruckenberg.