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

image-exif-reader

v1.0.3

Published

一个简单的图片 EXIF 数据读取器

Downloads

38

Readme

Image EXIF Reader

一个简单的图片 EXIF 数据读取器,支持读取 JPEG、TIFF 等格式图片的 EXIF 元数据。

功能特点

  • 支持多种图片格式:JPEG/JPG、TIFF、HEIC/HEIF、PNG、WebP。
  • 读取常见 EXIF 数据:相机信息、拍摄参数、镜头信息等。
  • 简单易用的 API
  • 支持浏览器直接使用
  • 轻量级,无依赖

快速开始

直接使用

<!-- 引入插件 -->
<script src="dist/imageExifReader.min.js"></script>
<!-- HTML -->
<input type="file" id="imageInput" accept="image/jpeg,image/jpg" />
<div id="exifData"></div>
<script>
  // 初始化读取器
  const reader = new ImageExifReader();
  // 处理文件选择
  document
    .getElementById("imageInput")
    .addEventListener("change", function (e) {
      const file = e.target.files[0];
      if (!file) return;
      reader.readExifData(file, function (error, exifData) {
        if (error) {
          console.error("读取 EXIF 数据时出错:", error);
          return;
        }
        console.log("EXIF 数据:", exifData);
      });
    });
</script>

NPM 安装

npm install image-exif-reader
import ImageExifReader from "image-exif-reader";

const reader = new ImageExifReader();
function handleImageUpload(file) {
  reader.readExifData(file, (error, exifData) => {
    if (error) {
      console.error("读取失败:", error);
      return;
    }
    console.log("EXIF 数据:", exifData);
  });
}

API 文档

ImageExifReader

readExifData(file, callback)

读取图片的 EXIF 数据。

参数

  • file:File - 图片文件对象。
  • callback:Function(error, exifData)
    • error:Error | null - 错误信息。
    • exifData:Object - EXIF 数据对象。

返回数据示例

{
    Make: "Panasonic",
    Model: "DC-G9",
    DateTime: "2022-03-26 18:20:19",
    ExposureTime: "1/125",
    FNumber: "f/1.7",
    FocalLength: "25mm",
    ISOSpeedRatings: 400,
    LensModel: "LUMIX G 25mm F1.7"
}

支持的 EXIF 标签

基本信息

  • Make:相机制造商。
  • Model:相机型号。
  • DateTime:拍摄时间。
  • Software:软件信息。

拍摄参数

  • ExposureTime:曝光时间。
  • FNumber:光圈值。
  • ISOSpeedRatings:ISO 感光度。
  • FocalLength:焦距。
  • ExposureMode:曝光模式。
  • WhiteBalance:白平衡。

镜头信息

  • LensModel:镜头型号。
  • LensSerialNumber:镜头序列号。
  • FocalLengthIn35mmFilm:35mm 等效焦距。

图像信息

  • XResolution:X 轴分辨率。
  • YResolution:Y 轴分辨率。
  • ResolutionUnit:分辨率单位。

开发

# 安装依赖
npm install
# 构建项目
npm run build
# 运行示例
npm run dev
# 运行测试
npm test

示例

查看 examples 目录中的完整示例代码。

浏览器兼容性

  • Chrome 50+
  • Firefox 50+
  • Safari 11+
  • Edge 18+

许可证

MIT

作者

zhengice

贡献

欢迎提交 Issue 和 Pull Request。

更新日志

1.0.0

  • 初始版本发布。
  • 支持 JPEG/TIFF 格式。
  • 基础 EXIF 数据读取。