tns plugin add nativescript-imageoptimize
import { ImageOptimize } from 'nativescript-imageoptimize';
import * as fs from 'tns-core-modules/file-system';
const imageoptimize = new ImageOptimize({
src: '~/destiny_2.jpg',
height: 400, //optional
width:400,
quality: 50, // 100 - 1
format:'jpg' // jpeg || jpg || png
dest: fs.knownFolders.documents().getFolder('images').path
})
const ImageOptimize = require('nativescript-imageoptimize').ImageOptimize;
const fs = require('tns-core-modules/file-system');
const imageoptimize = new ImageOptimize({
src: '~/destiny_2.jpg',
height: 400, //optional
width:400,
quality: 50, // 100 - 1
format:'jpg' // jpeg || jpg || png
dest: fs.knownFolders.documents().getFolder('images').path,
})
Property | Default | Type | Required | Description |
---|---|---|---|---|
width | source width | number |
|
|
height | source width | number |
|
|
quality | null | number |
|
|
format | jpg | string |
|
|
dest | null | string |
|
|
src | null | string |
|
Apache License Version 2.0, January 2004