压缩图片尺寸见图片处理api:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-image-V5设置解码参数DecodingOptions的desiredSize:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-image-V5\#decodingoptions7使用createPixelMap按照DecodingOptions创建PixelMap:let decodingOptions : image.DecodingOptions = { sampleSize: 1, editable: true, desiredSize: { width: 1, height: 2 }, rotate: 10, desiredPixelFormat: 3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err : BusinessError, pixelMap : image.PixelMap) => { if (err != undefined) { console.error(`Failed to create pixelMap.code is ${err.code},message is ${err.message}`); } else { console.info('Succeeded in creating pixelMap object.'); } })
压缩图片尺寸见图片处理api:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-image-V5
设置解码参数DecodingOptions的desiredSize:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-image-V5\#decodingoptions7
使用createPixelMap按照DecodingOptions创建PixelMap: