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

mipmap

v1.0.0

Published

[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

Readme

Mipmap Generator

License

Mipmap Generator 是一个用于生成多级纹理映射(mipmap)的 TypeScript 项目。它支持异步处理、缓存优化以及图像格式转换,适用于需要高效处理图像数据的场景。


功能特性

  • 多级纹理生成:通过递归下采样生成 mipmap 层级。
  • 图像格式转换:支持将图像数据转换为 JPEG、PNG 和 WebP 格式。
  • 异步处理:提供异步接口以提升性能。
  • 缓存优化:内置缓存机制,避免重复计算。
  • 三线性过滤:支持高质量的图像缩放和过滤。

安装

环境要求

  • Node.js >= 16.x
  • TypeScript >= 5.9.2

安装依赖

克隆项目后,运行以下命令安装依赖:

npm install

使用方法

1. 生成 Mipmap

使用 MipmapGenerator 类生成多级纹理映射:

import { MipmapGenerator } from './src/mipmapGenerator';

const imageData = new Uint8ClampedArray([...]); // 输入图像数据
const width = 256; // 图像宽度
const height = 256; // 图像高度

const generator = new MipmapGenerator(imageData, width, height);
console.log(generator.getLevel(0)); // 获取第 0 层 mipmap 数据

2. 转换图像格式

使用 ImageUtils.convertFormat 方法将图像数据转换为目标格式:

import { ImageUtils } from './src/imageUtils';

const imageData = new Uint8ClampedArray([...]); // 输入图像数据
const width = 256;
const height = 256;

const dataUrl = ImageUtils.convertFormat(imageData, width, height, 'png');
console.log(dataUrl); // 输出 Base64 编码的 PNG 数据

3. 加载远程图像

使用 ImageUtils.loadImage方法加载远程图像并获取其像素数据:

import { ImageUtils } from './src/imageUtils';

const imageUrl = 'https://example.com/image.png';

ImageUtils.loadImage(imageUrl).then((imageData) => {
    console.log(imageData); // 输出 ImageData 对象
});

许可证

本项目采用 MIT 许可证。详情请参阅 LICENSE 文件。