Socket
Book a DemoInstallSign in
Socket

expo-image-filter

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-image-filter

Apply iOS CIFilter in RN

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
2
-75%
Maintainers
0
Weekly downloads
 
Created
Source

expo-image-filter

Note: This module is still under development. Appreaciate any feedback or contributions!
iOS only for now

Apply filters to images in React Native. Works with expo-image, uses the native shared image object for blazingly fast performance.

Installation

$ npx expo install expo-image-filter
$ npx pod-install

Usage

import { useImage } from "expo-image";
import {
  createCIFilter,
  setFilterValue,
  getOutputImage,
  createBase64,
} from "expo-image-filter";

function App() {
  const [imageData, setImageData] = useState<string>();
  const inputImage = useImage({ uri: uri });

  const func = async () => {
    if (inputImage) {
      const nativeFilter = await createCIFilter("CISepiaTone");
      await setFilterValue(nativeFilter, "inputImage", image);
      await setFilterValue(nativeFilter, "inputIntensity", 1);
      const outputImageRes = getOutputImage(nativeFilter, true);
      const base64Image = await createBase64FromImage(outputImageRes);
      setImageData(base64Image);
    }
  };

  return imageData ? (
    <Image
      source={{ uri: `data:image/png;base64,${imageData}` }}
      style={{ width: 100, height: 100 }}
    />
  ) : (
    <></>
  );
}

Todo / Need help with:

  • Make result of getOutputImage compatible with <ExpoImage source={}>
  • Make result of getOutputImage be acceptable as setImageValue for filter chaining

Keywords

react-native

FAQs

Package last updated on 19 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts