Tiny Canvas Image Scaler
The purpose of this library is to be the smallest canvas-based image-scaling utility.
Usage
var imageScaler = var options = maxWidth: 300; imageScaler;
var imageScaler = var options = maxWidth: 200; imageScaler;
Options:
width
- to scale to (height will adjust proportionally)canvas
- canvas DOM node that will be used to perform the scaling (one will be created, if not provided)imageSmoothingEnabled
- property of the canvas contextimageSmoothingQuality
- property of the canvas contextimageFormat
- String,.toDataURL(imageFormat)
, defaults toimage/png
imageQuality
- Number,.toDataURL(imageFormat, imageQuality)
, defaults to0.92
Browser Support
All evergreen browsers plus IE11.