# @exodus/image-editor 中文文档

规范地址：https://npmcn.com/package/%40exodus/image-editor/

版本：2\.3\.0-exodus\.2
npm 元数据更新时间：2026-10-06T21:00:38.282Z
中文译文更新时间：2026-11-14T04:19:31.436Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40exodus/image-editor
原文对照：https://npmcn.com/package/%40exodus/image-editor/?lang=original
项目主页：https://github.com/react-native-community/react-native-image-editor#readme
源码仓库：https://github.com/react-native-community/react-native-image-editor

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：50.5 kB，20 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：react \>=16\.0，react-native \>=0\.57 \<0\.65
- 首次发布：2021-09-27T10:49:15.746Z
- 最新版本发布：2026-04-27T15:20:09.672Z
- 近 30 天下载量：6357（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：3（近 12 个月 1 个）

## 中文简介

为 iOS & Android 执行本地图像编辑本地模块

## 安装

```sh
npm install @exodus/image-editor
```

也可以使用：`pnpm add @exodus/image-editor`、`yarn add @exodus/image-editor`、`bun add @exodus/image-editor`

## README

# 反应-内生-图像编辑器

React Industrial 的图像编辑器本地模块 .

[![Build Status](https://img.shields.io/circleci/project/github/react-native-community/react-native-image-editor/master.svg?style=flat-square)](https://circleci.com/gh/react-native-community/react-native-image-editor) [![Version](https://img.shields.io/npm/v/@react-native-community/image-editor.svg?style=flat-square)](https://www.npmjs.com/package/@react-native-community/image-editor) [![MIT License](https://img.shields.io/npm/l/@react-native-community/image-editor.svg?style=flat-square)](https://opensource.org/licenses/MIT) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com/) [![Lean Core Badge](https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg?style=flat-square)](https://github.com/facebook/react-native/issues/23313)

## 开始

### 安装

`yarn add @react-native-community/image-editor`

或者说

`npm install @react-native-community/image-editor --save`

### 安装布德

`npx pod-install`

### 链接

`react-native link @react-native-community/image-editor`

## 使用量

从导入库开始 :

```javascript
import ImageEditor from "@react-native-community/image-editor";
```

### 裁剪图像

裁剪 URI param 指定的图像 。 如果URI指向远程图像,则会自动被下载. 如果图像无法装入/下載,则承诺会被拒绝.

如果裁剪过程成功,由此产生的裁剪图像会被存储在缓存路径中,而URI在承诺中返回会指向缓存路径中的图像. 记住在完成时从缓存路径中删除剪接的图像 .

```javascript
  ImageEditor.cropImage(uri, cropData).then(url => {
    console.log("Cropped image uri", url);
  })
```

### 裁剪数据

| 财产 | 需求 | 说明 |
| --- | --- | --- |
| `offset` | 对 | 剪接图像的左上角, 在原始图像的坐标空间中指定 |
| `size` | 对 | 剪切图像的大小( dimensions) |
| `displaySize` | 没有 | 要缩放已裁剪的图像的大小 |
| `resizeMode` | 没有 | 缩放图像时调整模式的大小( iOS, 机器人缩放模式总是“ 覆盖 ”) **默认值**:"夹" |

```javascript
  cropData = {
    offset: {x: number, y: number},
    size: {width: number, height: number},
    displaySize: {width: number, height: number},
    resizeMode: 'contain' | 'cover' | 'stretch',
  };
```

更高级的用途检查我们 [示例应用程序](https://npmcn.com/example/src/App.js)。 。 。 .

## 常见问题

### @exodus/image-editor 是什么？

为 iOS & Android 执行本地图像编辑本地模块

### 如何安装 @exodus/image-editor？

在项目目录运行 npm install @exodus/image-editor，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：react（\>=16\.0）、react-native（\>=0\.57 \<0\.65）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @exodus/image-editor 支持 TypeScript 吗？

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

### @exodus/image-editor 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @exodus/image-editor 可以商用吗？

@exodus/image-editor 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @exodus/image-editor 的下载量有多少？

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

### @exodus/image-editor 还在维护吗？

最新版本 2\.3\.0-exodus\.2 发布于 2026/04/27（6 个月前）；至今共发布 3 个版本，其中过去 12 个月发布了 1 个；首次发布于 2021/09/27。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

