Methods
(inner) canvasTo(canvas, returnType) → {Promise.<*>}
Parameters:
Name | Type | Description |
---|---|---|
canvas |
HTMLCanvasElement | |
returnType |
string |
|
Returns:
- Type
- Promise.<*>
(inner) readImage(source, optionopt, optionopt) → {Promise.<ImageBitmap>}
Support more than createImageBitmap().
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
source |
* | string and those supported by |
|
option |
string |
<optional> |
used only if |
option |
Object |
<optional> |
passed as the 2nd argument of |
Returns:
- Type
- Promise.<ImageBitmap>
(inner) resizeImage(source, settings) → {Promise.<*>}
Load and resize an image to specified format.
Safari does not support options.resize*
in createImageBitmap()
;
therefore we must draw the bitmap to canvas, instead of resizing it by calling creatImageBitmap()
.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source |
* | |||||||||||||||||||||||||||||||||||||||||
settings |
Object |
Properties
|
Returns:
- Type
- Promise.<*>
Example
/// resize the chosen file and then show it
resizeImage($('[type=file]').files[0], {scale: .5, returnType: 'dataURL'})
.then(url => location = url);