npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

doimg

v0.0.5

Published

an images decoding tool for nodejs

Readme

doimg

一个简单的图片解码工具

png解码器

const Png = require('doimg').Png;

let png = new Png(buffer);

console.log(png.width); // 图像宽度
console.log(png.height); // 图像高度
console.log(png.bitDepth); // 图像深度,即每个通道包含的位数
console.log(png.colorType); // 颜色类型,0 - 灰度,2 - rgb,3 - 索引,4 - 灰度+aloha,6 - rgba
console.log(png.alpha); // 是否使用alpha通道

let pixels = png.decode(); // 像素数据

gif解码器

const Gif = require('doimg').Gif;

let gif = new Gif(buffer);

console.log(gif.width); // 图像宽度
console.log(gif.height); // 图像高度
console.log(gif.bitDepth); // 图像深度
console.log(gif.backgroundColorIndex); // 背景颜色

let images = png.decode(); // 图片列表像素数据
let firstImg = images[0]; // 取图片列表中第一张

console.log(firstImg.left); // 图像左边偏移
console.log(firstImg.top); // 图像上边偏移
console.log(firstImg.width); // 图像宽度
console.log(firstImg.height); // 图像高度
console.log(firstImg.disposalMethod); // 处置方法,0 - 不使用处置方法,1 - 不处置图形,把图形从当前位置移去,2 - 回复到背景色,3 - 回复到先前状态
console.log(firstImg.userInputFlag); // 用户输入标志,指出是否期待用户有输入之后才继续进行下去,0 - 不期待,1 - 期待
console.log(firstImg.delayTime); // 延迟时间,单位1/100秒

jpeg解码器

const Jpeg = require('doimg').Jpeg;

let jpeg = new Jpeg(buffer);

console.log(jpeg.width); // 图像宽度
console.log(jpeg.height); // 图像高度
console.log(jpeg.thumbnailWidth); // 缩略图宽度
console.log(jpeg.thumbnailHeight); // 缩略图高度
console.log(jpeg.thumbnail); // 缩略图数据

let pixels = jpeg.decode(); // 像素数据

协议

MIT