This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo ImageManipulator iconExpo ImageManipulator

A library that provides an API for image manipulation on the local file system.

Android
iOS
tvOS
Web
Included in Expo Go
Recommended version:
~56.0.26

expo-image-manipulator provides an API to modify images stored on the local file system.

Installation

Terminal
- npx expo install expo-image-manipulator
- yarn expo install expo-image-manipulator
- pnpm expo install expo-image-manipulator
- bun expo install expo-image-manipulator

If you are installing this in an existing React Native app, make sure to install expo in your project.

Usage

This will first rotate the image 90 degrees clockwise, then flip the rotated image vertically and save it as a PNG.

Basic ImageManipulator usage
import { useEffect, useState } from 'react'; import { Button, Image, StyleSheet, Text, View } from 'react-native'; import { Asset } from 'expo-asset'; import { FlipType, SaveFormat, useImageManipulator } from 'expo-image-manipulator'; const IMAGE = Asset.fromModule(require('./assets/snack-icon.png')); export default function App() { const [imageUri, setImageUri] = useState(IMAGE.uri); const [isReady, setIsReady] = useState(false); const context = useImageManipulator(imageUri); const loadImageAsync = async () => { await IMAGE.downloadAsync(); setImageUri(IMAGE.localUri ?? IMAGE.uri); setIsReady(true); }; useEffect(() => { loadImageAsync(); }, []); const rotate90andFlip = async () => { context.rotate(90).flip(FlipType.Vertical); const renderedImage = await context.renderAsync(); const result = await renderedImage.saveAsync({ format: SaveFormat.PNG, }); setImageUri(result.uri); }; if (!isReady) { return ( <View style={styles.container}> <Text>Loading image...</Text> </View> ); } return ( <View style={styles.container}> <View style={styles.imageContainer}> <Image source={{ uri: imageUri }} style={styles.image} /> </View> <Button title="Rotate and Flip" onPress={rotate90andFlip} /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', }, imageContainer: { marginVertical: 20, alignItems: 'center', justifyContent: 'center', }, image: { width: 300, height: 300, resizeMode: 'contain', }, });

API

import * as ImageManipulator from 'expo-image-manipulator';

No API data file found, sorry!