|
- api.getPicture({
- sourceType: 'album',
- encodingType: 'jpg',
- mediaValue: 'pic',
- destinationType: 'url',
- allowEdit: true,
- quality: 100,
- saveToPhotoAlbum: false
- }, function (ret, err) {
- if (ret) {
- path = ret.data;
- var imageFilter = api.require('imageFilter');
- **.**press({
- img: path,
- quality: 0.5,
- size: {
- w: 300,
- h: 600
- },
- save: {
- album: true, //(可选项)布尔值,是否保存到系统相册,默认false
- imgPath: 'fs://myapp', //(可选项)保存的文件路径,字符串类型,无默认值,不传或传空则不保存,若路径不存在文件夹则创建此目录
- imgName: 'test1.jpg'
- }
- }, function (ret, err) {
- if (ret.status) {
- alert(JSON.stringify(ret));
- } else {
- alert(JSON.stringify(err));
- }
- });
- } else {
- api.alert({
- msg: JSON.stringify(err)
- });
- }
- });
复制代码
我这测试压缩后是指定宽高帅0927 · 2022-6-22 10:39是的 竖着拍h是比w大,但是之前用imageOptim组件,他虽然写了固定宽600高300,也等比例压缩了。 您推荐我用的这个imageFilter写了固定宽高就没等比例压缩。
... |
|