参考文档地址:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/image-decoding-V5
核心代码:
let fileData = await getContext().resourceManager.getRawFileContent("test.gif");
const buffer = fileData.buffer.slice(0);
const imageSource : image.ImageSource = image.createImageSource(buffer);
let pixelMap = await imageSource.createPixelMap();
参考接口:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-image-V5\#createpixelmaplist10