本地PNG操作库PNGjs-Image.zip

时间:2022-08-05 23:28:59
【文件属性】:
文件名称:本地PNG操作库PNGjs-Image.zip
文件大小:3.57MB
文件格式:ZIP
更新时间:2022-08-05 23:28:59
开源项目 PNGjs-Image 是本地 PNG 操作库。示例代码:var image = PNGImage.createImage(100, 300); // Get width and height console.log(image.getWidth()); console.log(image.getHeight()); // Set a pixel at (20, 30) with red, having an alpha value of 100 (half-transparent) image.setAt(20, 30, { red:255, green:0, blue:0, alpha:100 }); // Get index of coordinate in the image buffer var index = image.getIndex(20, 30); // Print the red color  valueconsole.log(image.getRed(index)); // Get low level image object with buffer from the 'pngjs' package var pngjs = image.getImage(); image.writeImage('path/to/file', function () {     console.log('Written to the file'); }) 标签:PNGjs

网友评论