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
A library that provides an API for image manipulation on the local file system.
expo-image-manipulator provides an API to modify images stored on the local file system.
Installation
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.
API
import * as ImageManipulator from 'expo-image-manipulator';
Constants
Type: ImageManipulator
Hooks
Classes
Type: Class extends NativeModule
ImageManipulator Methods
Loads an image from the given URI and creates a new image manipulation context.
ImageManipulatorContextType: Class extends SharedObject
A context for an image manipulation. It provides synchronous, chainable functions that schedule transformations on the original image to the background thread.
Use an asynchronous renderAsync to await for all transformations to finish and access the final image.
ImageManipulatorContext Methods
Set the image size and offset. If the image is enlarged, unfilled areas are set to the backgroundColor.
To position the image, use originX and originY.
ImageManipulatorContextAwaits for all manipulation tasks to finish and resolves with a reference to the resulted native image.
Promise<ImageRef>Resets the manipulator context to the originally loaded image.
ImageManipulatorContextType: Class extends SharedRef<'image'>
A reference to a native instance of the image.
ImageRef Properties
ImageRef Methods
Methods
Deprecated: It has been replaced by the new, contextual and object-oriented API. Use
ImageManipulator.manipulateoruseImageManipulatorinstead.
Manipulate the image provided via uri. Available modifications are rotating, flipping (mirroring),
resizing and cropping. Each invocation results in a new file. With one invocation you can provide
a set of actions to perform over the image. Overwriting the source file would not have an effect
in displaying the result as images are cached.
Promise<ImageResult>Promise which fulfils with ImageResult object.
Types
Literal type: union
Acceptable values are: ActionResize | ActionRotate | ActionFlip | ActionCrop | ActionExtent