HarmonyOS 鸿蒙Next ets 目录下的图片怎么转pixelmap
HarmonyOS 鸿蒙Next ets 目录下的图片怎么转pixelmap
ets 目录下的图片怎么转pixelmap
关于HarmonyOS 鸿蒙Next ets 目录下的图片怎么转pixelmap的问题,您也可以访问:https://www.itying.com/category-93-b0.html 联系官网客服。
2 回复
这是获取rawfile下图像的代码
const resourceMgr : resourceManager.ResourceManager = entryContext.resourceManager;
let fd = resourceMgr.getRawFdSync(imageName)
let imageSource:image.ImageSource = image.createImageSource(fd);
imageSource.createPixelMap((err: BusinessError, pixelMap: image.PixelMap) => {
if (err) {
hilog.error(0x0001,"canvas","加载图像失败,错误码[%{public}d],错误信息[%{public}s]",err.code,err.message);
} else {
}
})
<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>
您好,欢迎是用eftool中的Imageutil进行转换
调用ImageUtil.getPixelMapFromMedia获取image.PixelMap