Package Exports
- hastily
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hastily) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hastily
Drop-in compatible Express middleware to replicate the Fastly Image Optimization API
Usage
The middleware works a lot like compression, a standard Express middleware which transparently compresses any text-based response body that emits from something in the middleware chain.
So hastily works as an add-on to an Express server or middleware that is already serving images.
import express, { static } from 'express';
import { imageopto } from 'hastily';
const app = express();
app.use('/images', imageopto(), static('/www/images'));
app.listen(8000);You now have an app which can serve any image from /www/images, and optimize it with URL parameters from the Fastly Image Optimization API.
API
hastily.imageopto()
TODO
- implement resize and crop mappers
- throw on unsupported
- implement enable and disable for upscaling in resize
- implement format, auto=webp, and quality params in post-manip phase
- add unit tests
- add image-diff automated testing
- implement sharpen, mapping [amt, radius, threshold] to libvips sharpen params
- implement brightness, contrast, saturation by figuring out percentage to multiplier mapping
- use image.metadata() to implement relative and context-based methods
- add header-based methods
- montage
- overlay