npm install @triniwiz/nativescript-imageoptimize
import { ImageOptimize } from '@triniwiz/nativescript-imageoptimize';
import {knownFolders} from '@nativescript/core';
const imageoptimize = ImageOptimize.optimize({
src: '~/destiny_2.jpg',
height: 400, //optional
width:400, //optional
quality: 50, // optional 100 - 1
format:'jpg', // jpeg || jpg || png || webp *android
dest: knownFolders.documents().getFolder('images').path
}).then(
(res)=>{
console.log(res.file)
},(err)=>{
console.log(err.message)
}
)
const ImageOptimize = require('@triniwiz/nativescript-imageoptimize').ImageOptimize;
const core = require('@nativescript/core');
ImageOptimize.optimize({
src: '~/destiny_2.jpg',
height: 400, //optional
width:400,
quality: 50, // 100 - 1
format:'jpg', // jpeg || jpg || png || webp *android
dest: core.knownFolders.documents().getFolder('images').path,
}).optimize().then(
(res)=>{
console.log(res.file)
},(err)=>{
console.log(err.message)
}
)
Property | Default | Type | Required | Description |
---|---|---|---|---|
width | source width | number | ||
height | source width | number | ||
quality | 92 | number | ||
format | jpg | string | ||
dest | null | string | ||
src | null | string |
Apache License Version 2.0