@baronha/react-native-photo-editor

中文文档
1.1.6发布于 2023/01/02MITTypeScriptESM + CJS零依赖近 30 天下载 5698

🌄 Image editor using native modules for iOS and Android

原始使用文档
文档目录22 节
  1. Feature 🙈
  2. Both
  3. iOS
  4. Android
  5. Video Demo 📺
  6. ScreenShot 👉👈
  7. iOS
  8. Android
  9. Requirements
  10. Installation
  11. iOS
  12. Usage
  13. Options
  14. Filters 🌈
  15. Custom Filters(iOS)
  16. Stickers 🤌
  17. Remote
  18. Local
  19. To Do
  20. Performance
  21. Contributing
  22. License

React Native Photo Editor (RNPE)

🌄 Image editor using native modules for iOS and Android. Inherit from 2 available libraries, ZLImageEditor (iOS) and PhotoEditor (Android)

Note

The difference between the 2 platforms is huge - Be careful when using
This lib is for personal use, so if you customize your style or change something, Please fork this library and check the detailed documentation in the original library:

During the development of this package. I was thinking of moving it as part of an earlier library that I finished. If the support community for this library was large enough, I would have to dismiss this idea immediately.

Previously this library used Brightroom as the native library for iOS. If you want to use Brightroom you can check it out here.

Feature 🙈

Both

  • Draw (Support custom line color).
  • Adding/Editing Text with option to change its Color.
  • Adding Images/Stickers
  • Pinch to Scale and Rotate views.

iOS

  • Apply Filter Effect on image using LUT Color (Custom filter is simpler than android)
  • Crop image.

Android

  • Drawing on image with option to change its Brush's Color, Size, Opacity, Erasing and basic shapes.
  • Apply Filter Effect on image using MediaEffect. But in the future will change to LUT color.

Video Demo 📺

iOSAndroid

ScreenShot 👉👈

iOS


Android

Requirements

  • Swift 5.1+ (Xcode12.4+)
  • iOS 12+

Installation

yarn add @baronha/react-native-photo-editor

iOS

The Swift pod @baronha/react-native-photo-editor depends upon SDWebImage and SDWebImageWebPCoder, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies:

pod 'SDWebImage', :modular_headers => true
pod 'SDWebImageWebPCoder', :modular_headers => true

Then run cd ios/ && pod install

Don't forget add file .swift in your project (and create bridging header file swift).

Usage

import PhotoEditor from "@baronha/react-native-photo-editor";

// ...

const result = await PhotoEditor.open(Options);

Options

PropertyTypeDefault valuePlatformDescription
pathstringrequiredbothLocal/remote image path
stickersArray[]bothAn array of paths containing sticker images

Filters 🌈

iOSAndroid

Custom Filters(iOS)

LUT (Hald image)

How to create cube data from LUT Image

We can download the neutral LUT image from lutCreator.js.

Hald Images

Hald is a graphical representation of 3D LUT in a form of a color table which contains all of the color gradations of 3D LUT. If Hald is loaded into editing software and a color correction is applied to it, you can use 3D LUT Creator to convert your Hald into 3D LUT and apply it to a photo or a video in your editor.

Detailed documentations are available on here

IMPORTANT You have to create LUTs.bundle and add all your LUT Photo(Re-name your LUT Photo follow this format: LUT_64_FILTER_NAME) into LUTs.bundle. Then add LUTs.bundle into Copy Bundle Resources. See detail

Stickers 🤌

Remote

You need to pass an array of image urls to the sticker parameter in options Example:

[
  "https://cdn-icons-png.flaticon.com/512/5272/5272912.png",
  "https://cdn-icons-png.flaticon.com/512/5272/5272913.png",
  "https://cdn-icons-png.flaticon.com/512/5272/5272916.png",
  ...
] 

Local

iOS

You have to create Stickers.bundle and add all your sticker into Stickers.bundle. Then add Stickers.bundle into Copy Bundle Resources. See detail

Android

You have to create Stickers folder inside assets folder. Then drag or copy all sticker in to Sticker folder. See detail

To Do

  • Lut Color in android.
  • Crop Image in android.

Performance

We're trying to improve performance. If you have a better solution, please open a issue or pull request. Best regards!

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

版本与发布记录

@baronha/react-native-photo-editor 共发布 11 个版本,首次发布于 2021/08/03;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.6latest2023/01/023 年前
1.1.52022/11/083 年前
1.1.42021/11/104 年前
1.1.32021/11/035 年前
1.1.22021/11/035 年前
1.1.12021/11/025 年前

关于 @baronha/react-native-photo-editor 的常见问题

@baronha/react-native-photo-editor 是什么?

🌄 Image editor using native modules for iOS and Android

如何安装 @baronha/react-native-photo-editor?

在项目目录运行 npm install @baronha/react-native-photo-editor,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@baronha/react-native-photo-editor 支持 TypeScript 吗?

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

@baronha/react-native-photo-editor 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@baronha/react-native-photo-editor 可以商用吗?

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

@baronha/react-native-photo-editor 的下载量有多少?

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

@baronha/react-native-photo-editor 还在维护吗?

最新版本 1.1.6 发布于 2023/01/02(3 年前);至今共发布 11 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/08/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。