百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

react-native-color-matrix-image-filters

> 前端框架
开源

适用于 iOS 和 Android 的各种基于色彩矩阵的图像滤镜

374 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

适用于 iOS 和 Android 的各种基于色彩矩阵的图像滤镜

react-native-color-matrix-image-filters

Various color matrix based image filters for iOS & Android.

Status

  • iOS & Android:
    • filter components work as wrappers for Image, ImageBackground, react-native-fast-image and expo‑image components
    • doesn't support gif format on iOS
  • react-native:
    • supported versions: ">=0.60.0"
    • supports both "old" and "new" architecture

Getting started

1. Install latest version from npm

bash
npm i react-native-color-matrix-image-filters

2. Install pods

if using "old" architecture:

bash
npx pod-install

if using "new" architecture:

RCT_NEW_ARCH_ENABLED=1 npx pod-install

Scope

This module is meant to be used for simple stuff, like "grayscaling inactive user avatar" etc. Check react-native-image-filter-kit if you need some advanced features like image blending/composing, extracting filtering results to file system and ability to create custom filters.

Example

javascript
import { Image } from 'react-native'
import {
  Grayscale,
  Sepia,
  Tint,
  ColorMatrix,
  concatColorMatrices,
  invert,
  contrast,
  saturate
} from 'react-native-color-matrix-image-filters'

const GrayscaledImage = (imageProps) => (
  
    
  
)

const CombinedFiltersImage = (imageProps) => (
  
    
  
)

const ColorMatrixImage = (imageProps) => (
  
    
  
)
Original Grayscaled
CombinedFilters ColorMatrix

Usage

Each filter support all of View props. Also some filters have optional amount prop which takes a number. ColorMatrix filter has matrix prop which takes a Matrix - an array of 20 numbers. Additionally library exports functions like grayscale, tint etc. - these functions return values of Matrix type and their results can be combined with concatColorMatrices function.

Reference

Supported filters

Component Additional props function
ColorMatrix matrix: Matrix -
Normal - normal(): Matrix
RGBA red: number = 1, green: number = 1, blue: number = 1, alpha: number = 1 rgba(red: number = 1, green: number = 1, blue: number = 1, alpha: number = 1): Matrix
Saturate amount: number = 1 saturate(amount: number = 1): Matrix
HueRotate amount: number = 0 hueRotate(amount: number = 0): Matrix
LuminanceToAlpha - luminanceToAlpha(): Matrix
Invert - invert(): Matrix
Grayscale amount: number = 1 grayscale(amount: number = 1): Matrix
Sepia amount: number = 1 sepia(amount: number = 1): Matrix
Nightvision - nightvision(): Matrix
Warm - warm(): Matrix
Cool - cool(): Matrix
Brightness amount: number = 1 brightness(amount: number = 1): Matrix
Contrast amount: number = 1 contrast(amount: number = 1): Matrix
Temperature amount: number = 1 temperature(amount: number = 1): Matrix
Tint amount: number = 0 tint(amount: number = 0): Matrix
Threshold amount: number = 0 threshold(amount: number = 0): Matrix
Technicolor - technicolor(): Matrix
Polaroid - polaroid(): Matrix
ToBGR - toBGR(): Matrix
Kodachrome - kodachrome(): Matrix
Browni - browni(): Matrix
Vintage - vintage(): Matrix
Night amount: number = 0.1 night(amount: number = 0.1): Matrix
Predator amount: number = 1 predator(amount: number = 1): Matrix
Lsd - lsd(): Matrix
ColorTone desaturation: number = 0.2, toned: number = 0.15, lightColor: string = "#FFE580", darkColor: string = "#338000" colorTone(desaturation: number = 0.2, toned: number = 0.15, lightColor: string = "#FFE580", darkColor: string = "#338000"): Matrix
DuoTone firstColor: string = "#FFE580", secondColor: string = "#338000" duoTone(firstColor: string = "#FFE580", secondColor: string = "#338000"): Matrix
Protanomaly - protanomaly(): Matrix
Deuteranomaly - deuteranomaly(): Matrix
Tritanomaly - tritanomaly(): Matrix
Protanopia

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcolor-matriximage-filtersreact-native

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架