![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
image-wasm-for-war3
Advanced tools
image-wasm-for-war3 是一个使用 WebAssembly 技术实现的图像处理库,可以在浏览器和 Node.js 环境中使用。该库提供了一组 API,用于对 RGBA 的图像数据进行解码和编码
您可以使用 npm 包管理器来安装 image-wasm-for-war3:
npm install image-wasm-for-war3
const fs = require("fs");
const { ImageType, encode } = require("../index");
const data = new Uint8Array(
new Array(100 * 100 * 4).fill(0).map((_, i) => i % 255)
);
encode(data.buffer, 100, 100, ImageType.Tga).then((tgaContent) => {
fs.writeFileSync("test.tga", Buffer.from(tgaContent));
});
const fs = require("fs");
const { ImageType, decode } = require("image-wasm-for-war3");
const data = new Uint8Array(
new Array(100 * 100 * 4).fill(0).map((_, i) => i % 255)
);
encode(fs.readFileSync('test.tga').buffer, ImageType.Tga).then((rgbaData) => {
console.info(rgbaData.width);
console.info(rgbaData.height);
console.info(rgbaData.buffer);
});
const fs = require("fs");
const { Blp1File, encode, decode, ImageType } = require("image-wasm-for-war3");
const resizeImage = await decode(fs.readFileSync('some jpeg path'), ImageType.Jpeg);
// 生成一个 mimap是一个 质量是80 的blp1文件
const blpContent = await Blp1File.encode(resizeImage).encode(1, 80);
// 保存文件
fs.writeFileSync('some blp path', Buffer.from(blpContent));
// 获取blp的第一张mimap数据
const blpImageData = await Blp1File.decode(fs.readFileSync('some blp path').buffer).getMimapData(0);
// 编码成png
const pngContent = await encode(blpImageData.buffer, blpImageData.width, blpImageData.height, ImageType.Png);
// 保存成png
fs.writeFileSync('some png path', Buffer.from(pngContent));
在构建之前,您需要安装以下工具:
rustup target add wasm32-unknown-emscripten
npm i
npm run build
如果一切顺利,构建完成后您将会在 dist 目录下找到编译好的文件
FAQs
image process by wasm
The npm package image-wasm-for-war3 receives a total of 7 weekly downloads. As such, image-wasm-for-war3 popularity was classified as not popular.
We found that image-wasm-for-war3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.