@desert-ant-labs/eye

中文文档
4.3.0发布于 2026/11/06SEE LICENSE IN LICENSE.mdTypeScriptES Module近 30 天下载 7838

On-device photo understanding for JavaScript: scenes, quality, faces, people, pets, crops and sharpness. Runs in the browser (WebAssembly + LiteRT.js) and server-side in Node (native), from one import.

原始使用文档

@desert-ant-labs/eye

On-device photo understanding for JavaScript that runs in the browser and in Node: find and filter the photos you want. One call tags a photo with what it is (screenshot, receipt, selfie), what is in it (dog, beach, 558 scenes), how it came out (blurry, eyes closed), who is in it (group shot, portrait) and whether it is sensitive. Every tag has a confidence where 0.5 is the recommended cutoff and 0.9 a strict one. Images stay local.

Two entries share one Eye API:

  • @desert-ant-labs/eye (default): a WebAssembly pipeline with LiteRT.js inference, for the browser: on the GPU through WebGPU when the browser has it, else on the CPU. Safe to import during server-side rendering; Eye.load() runs inference only in a browser or Web Worker.
  • @desert-ant-labs/eye/native: a prebuilt native core, Core ML on macOS and LiteRT on Linux, for server-side inference in Node. Import it from server-only code.
npm i @desert-ant-labs/eye @litertjs/core   # browser
npm i @desert-ant-labs/eye                  # Node, prebuilt native core
import { Eye, Tag } from "@desert-ant-labs/eye";

const eye = await Eye.load();
const photo = await eye.analyze(image);
if (photo.has(Tag.dog) && !photo.has(Tag.blurry)) keep(photo);
photo.tags();               // ["photo", "beach", "people", "smiling", ...]
photo.has(Tag.sensitive, "strict");
photo.bestCrop(1);          // a square thumbnail

const groups = Eye.duplicates(library, { dates });   // near-duplicates, best first
eye.dispose();

JSON.stringify(photo) stores an analysis and Analysis.fromJSON restores it, so a library can be filtered later without the model. options.parts picks what to compute ("photo", "layout", "faces", "sharpness"; all by default); tags that need a part left out are absent. In the browser, image is anything createImageBitmap accepts or an ImageData. In Node, pass decoded pixels as { data, width, height } with RGB or RGBA bytes, upright:

import sharp from "sharp";
import { Eye } from "@desert-ant-labs/eye/native";

const { data, info } = await sharp("photo.jpg").rotate().raw().toBuffer({ resolveWithObject: true });
const photo = await eye.analyze({ data, width: info.width, height: info.height });

The full guide is in the Eye docs.

License

Desert Ant Labs Source-Available License. Free for most apps, and a commercial license is required at scale. Full terms are at the link. Licensing: [email protected].

Third-party notices for the SDK: THIRD_PARTY_NOTICES.md.

Third-party notices for the weights: THIRD_PARTY_NOTICES.md.

版本与发布记录

@desert-ant-labs/eye 共发布 8 个版本,首次发布于 2026/10/16;过去 12 个月发布了 8 个版本。

版本发布日期距今
4.3.0latest2026/11/066 天前
4.2.32026/10/3112 天前
4.2.22026/10/3112 天前
4.2.12026/10/2815 天前
4.2.02026/10/2716 天前
4.1.02026/10/2023 天前

关于 @desert-ant-labs/eye 的常见问题

@desert-ant-labs/eye 是什么?

On-device photo understanding for JavaScript: scenes, quality, faces, people, pets, crops and sharpness. Runs in the browser (WebAssembly + LiteRT.js) and server-side in Node (native), from one import.

如何安装 @desert-ant-labs/eye?

在项目目录运行 npm install @desert-ant-labs/eye,或使用 pnpm add / yarn add / bun add。

@desert-ant-labs/eye 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@desert-ant-labs/eye 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@desert-ant-labs/eye 可以商用吗?

@desert-ant-labs/eye 使用 SEE LICENSE IN LICENSE.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@desert-ant-labs/eye 的下载量有多少?

根据 npm 官方下载统计,@desert-ant-labs/eye 在 2026/10/12 – 2026/11/10 这 30 天内被下载 7,838 次,日均约 261 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@desert-ant-labs/eye 还在维护吗?

最新版本 4.3.0 发布于 2026/11/06(6 天前);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/10/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。