Windows 支持 heic 图片显示
创建 package.json
bash
npm init -y
安装 heic-convert
bash
npm i heic-convert
创建 index.js 内容如下
bash
touch index.js
javascript
const { promisify } = require("util");
const fs = require("fs");
const convert = require("heic-convert");
(async () => {
const inputBuffer = await promisify(fs.readFile)("sample1.heic");
const outputBuffer = await convert({
buffer: inputBuffer, // the HEIC file buffer
format: "JPEG", // output format
quality: 1 // the jpeg compression quality, between 0 and 1
});
await promisify(fs.writeFile)("./result.jpg", outputBuffer);
})();
执行转换
bash
node index.js