High-performance, GPU-accelerated image editing library for React Native
Transform, filter, and enhance images with blazing-fast GPU processing using Metal (iOS) and GPU-accelerated operations (Android). Built on React Native's New Architecture for optimal performance.
- β‘ Metal (iOS) & GPU ColorMatrix (Android) for hardware-accelerated processing
- π― Real-time preview with zero lag
- π± Optimized for iOS 18+ and Android 13+
- ποΈ Built with React Native New Architecture (TurboModules)
- πΈ Document Scanning Filters: scan, enhance, black & white, perspective correction
- π¨ Photo Editing Filters: 20+ Instagram-style presets (sepia, vintage, vivid, dramatic, etc.)
- ποΈ Custom Filters: Adjustable brightness, contrast, saturation, and more
- π Real-time Preview Component: Instant filter visualization
- πΎ Batch Processing: Apply filters to multiple images efficiently
- βοΈ Interactive Cropping: Touch gestures with grid overlay and aspect ratio locking
- π Smart Resizing: Multiple modes (cover, contain, stretch) with high-quality scaling
- π Rotation: Any angle with optional canvas expansion
- πΌοΈ Native UI Component:
CropperViewfor interactive cropping
- π Support for local (
file://) and remote (https://) images - π¦ Multiple return formats: URI, Base64, or both
- ποΈ Adjustable JPEG/PNG quality
- πΎ Automatic file management and caching
Experience real-time GPU-accelerated filtering with instant preview:
| iOS | Android |
|---|---|
![]() |
Interactive cropping, resizing, and rotation with native gesture support:
| iOS | Android |
|---|---|
![]() |
npm install @dariyd/react-native-image-filtersor
yarn add @dariyd/react-native-image-filterscd ios && pod installRequirements:
- iOS 18.0+
- Metal-capable device
Requirements:
- Android 13+ (API 33)
- Gradle auto-configuration included
Display images with live filter effects:
import { FilteredImageView } from '@dariyd/react-native-image-filters';
function App() {
const [intensity, setIntensity] = useState(1.0);
return (
<FilteredImageView
source={{ uri: 'https://example.com/image.jpg' }}
filter="vivid"
intensity={intensity}
style={{ width: 300, height: 400 }}
resizeMode="cover"
onFilterApplied={() => console.log('Filter applied!')}
onError={(error) => console.error('Error:', error)}
/>
);
}Process images and save the filtered result:
import { applyFilter } from '@dariyd/react-native-image-filters';
async function processImage() {
const result = await applyFilter({
sourceUri: 'file:///path/to/image.jpg',
filter: 'scan',
intensity: 1.0,
returnFormat: 'uri', // 'uri' | 'base64' | 'both'
quality: 90,
});
console.log('Filtered image:', result.uri);
console.log('Dimensions:', result.width, 'x', result.height);
}Let users crop images with touch gestures:
import { CropperView } from '@dariyd/react-native-image-filters';
function CropScreen() {
const [cropRect, setCropRect] = useState(null);
return (
<CropperView
source={{ uri: 'https://example.com/image.jpg' }}
aspectRatio={16/9} // Optional: lock aspect ratio
showGrid={true}
gridColor="#FFFFFF"
overlayColor="rgba(0, 0, 0, 0.5)"
onCropRectChange={(rect) => setCropRect(rect)}
onGestureEnd={(rect) => console.log('Final crop:', rect)}
style={{ width: '100%', height: 400 }}
/>
);
}Perform transformations programmatically:
import { cropImage, resizeImage, rotateImage } from '@dariyd/react-native-image-filters';
// Crop to specific region
const cropped = await cropImage({
sourceUri: 'image.jpg',
cropRect: { x: 100, y: 100, width: 500, height: 500 },
returnFormat: 'uri',
quality: 90,
});
// Resize with different modes
const resized = await resizeImage({
sourceUri: 'image.jpg',
width: 800,
height: 600,
mode: 'contain', // 'cover' | 'contain' | 'stretch'
returnFormat: 'uri',
quality: 90,
});
// Rotate by any angle
const rotated = await rotateImage({
sourceUri: 'image.jpg',
degrees: 45,
expand: true, // Expand canvas to fit rotated image
returnFormat: 'uri',
quality: 90,
});Process multiple images efficiently:
import { applyFilters } from '@dariyd/react-native-image-filters';
async function processMultiple() {
const results = await applyFilters([
{ sourceUri: 'image1.jpg', filter: 'sepia', intensity: 0.8 },
{ sourceUri: 'image2.jpg', filter: 'vivid', intensity: 1.0 },
{ sourceUri: 'image3.jpg', filter: 'scan', intensity: 1.0 },
]);
results.forEach((result, index) => {
console.log(`Image ${index}: ${result.uri} (${result.width}x${result.height})`);
});
}Create your own filter effects:
const result = await applyFilter({
sourceUri: 'image.jpg',
filter: 'custom',
customParams: {
brightness: 1.2, // 0.5 - 2.0
contrast: 1.5, // 0.5 - 2.0
saturation: 0.8, // 0.0 - 2.0
hue: 0.1, // 0.0 - 1.0
blur: 5, // 0 - 25
},
intensity: 0.9,
});Cache images for faster processing:
import { preloadImage } from '@dariyd/react-native-image-filters';
await preloadImage('https://example.com/large-image.jpg');
// Image is now cached and ready for instant filteringDiscover all available filters:
import { getAvailableFilters } from '@dariyd/react-native-image-filters';
const documentFilters = await getAvailableFilters('document');
// ['scan', 'blackWhite', 'enhance', 'perspective', 'grayscale', 'colorPop']
const photoFilters = await getAvailableFilters('photo');
// ['sepia', 'noir', 'fade', 'chrome', 'vivid', 'dramatic', 'warm', 'cool', ...]Apply a filter to an image and save the result.
Options:
{
sourceUri: string; // Image URI (file://, https://, content://)
filter: FilterName; // Filter name or 'custom'
intensity?: number; // Filter intensity 0-1 (default: 1)
customParams?: Record<string, number>; // Custom filter parameters
returnFormat?: 'uri' | 'base64' | 'both'; // Output format (default: 'uri')
quality?: number; // JPEG quality 0-100 (default: 90)
}Returns:
{
uri?: string; // File URI to filtered image
base64?: string; // Base64-encoded image data
width: number; // Output width in pixels
height: number; // Output height in pixels
}Batch process multiple images in parallel.
Get list of available filters by category.
Parameters:
type:'document'|'photo'|'custom'(optional, returns all if omitted)
Crop an image to a specific rectangle.
Options:
{
sourceUri: string;
cropRect: {
x: number; // Top-left X coordinate
y: number; // Top-left Y coordinate
width: number; // Crop width
height: number; // Crop height
};
returnFormat?: 'uri' | 'base64' | 'both';
quality?: number; // 0-100
}Resize an image with different scaling modes.
Options:
{
sourceUri: string;
width: number; // Target width
height: number; // Target height
mode: 'cover' | 'contain' | 'stretch'; // Resize mode
returnFormat?: 'uri' | 'base64' | 'both';
quality?: number;
}Resize Modes:
cover: Scale to fill dimensions, crop excess (maintains aspect ratio)contain: Scale to fit within dimensions (maintains aspect ratio, may have padding)stretch: Scale to exact dimensions (may distort aspect ratio)
Rotate an image by any angle.
Options:
{
sourceUri: string;
degrees: number; // Rotation angle (-360 to 360)
expand?: boolean; // Expand canvas to fit rotated image (default: true)
returnFormat?: 'uri' | 'base64' | 'both';
quality?: number;
}Pre-download and cache remote images for faster processing.
Clear the image cache to free memory.
Real-time filter preview component with GPU acceleration.
Props:
{
source: { uri: string }; // Image source
filter: FilterName; // Filter to apply
intensity?: number; // Filter intensity 0-1
customParams?: Record<string, number>; // Custom parameters
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
style?: ViewStyle;
onFilterApplied?: () => void;
onError?: (error: Error) => void;
}Interactive image cropping component with gesture support.
Props:
{
source: { uri: string } | string; // Image source
initialCropRect?: CropRect; // Initial crop area
aspectRatio?: number; // Lock aspect ratio (e.g., 16/9)
minCropSize?: { width: number; height: number }; // Min crop dimensions
showGrid?: boolean; // Show grid overlay (default: true)
gridColor?: string; // Grid line color
overlayColor?: string; // Overlay color (default: 'rgba(0,0,0,0.5)')
style?: ViewStyle;
onCropRectChange?: (rect: CropRect) => void; // Real-time updates
onGestureEnd?: (rect: CropRect) => void; // Final crop rect
}Features:
- β Touch gestures: pinch to zoom, pan to move, drag corners/edges to resize
- π Optional aspect ratio locking
- π― Grid overlay for precise alignment
- π Real-time crop rect updates
- π± Native performance on iOS and Android
Perfect for scanning documents, receipts, whiteboards, and business cards:
| Filter | Description | Use Case |
|---|---|---|
scan |
Adaptive threshold + contrast + sharpness | Default document scan |
blackWhite |
High-contrast B&W with noise reduction | Handwritten notes, receipts |
enhance |
Smart brightness/contrast/saturation boost | Poor lighting conditions |
perspective |
Auto perspective correction | Angled photos |
grayscale |
Grayscale conversion | Text documents |
colorPop |
Increased saturation and clarity | Colorful documents, diagrams |
Instagram-style presets with adjustable intensity:
| Filter | Style | Effect |
|---|---|---|
sepia |
Vintage | Warm brown tone |
noir |
Black & White | Classic monochrome |
fade |
Retro | Reduced contrast, desaturated |
chrome |
Modern | Metallic, high contrast |
transfer |
Film | Analog film simulation |
instant |
Polaroid | Instant camera look |
vivid |
Bold | Boosted colors, sharp |
dramatic |
Intense | Deep shadows, vibrant |
warm |
Cozy | Orange/yellow tint |
cool |
Fresh | Blue tint |
vintage |
Old-school | Faded, warm glow |
clarendon |
Bright | High contrast, cool shadows |
gingham |
Soft | Desaturated, warm highlights |
juno |
Colorful | Warm tones, boosted saturation |
lark |
Light | Brightened, desaturated |
luna |
Moody | Blue/purple shadows |
reyes |
Dreamy | Washed out, warm |
valencia |
Warm | Orange tint, faded |
Build your own effects with these parameters:
| Parameter | Range | Default | Description |
|---|---|---|---|
brightness |
0.5 - 2.0 | 1.0 | Lightness adjustment |
contrast |
0.5 - 2.0 | 1.0 | Contrast adjustment |
saturation |
0.0 - 2.0 | 1.0 | Color intensity |
hue |
0.0 - 1.0 | 0.0 | Color shift |
blur |
0 - 25 | 0 | Gaussian blur radius |
sharpen |
0.0 - 2.0 | 0.0 | Sharpness |
exposure |
-2.0 - 2.0 | 0.0 | Exposure compensation |
temperature |
0.5 - 1.5 | 1.0 | Color temperature |
tint |
-1.0 - 1.0 | 0.0 | Green/Magenta shift |
vignette |
0.0 - 1.0 | 0.0 | Edge darkening |
grain |
0.0 - 1.0 | 0.0 | Film grain effect |
-
iOS: Metal framework for hardware-accelerated image processing
- Core Image filters with Metal backend
- Texture caching for real-time preview
- Zero-copy operations where possible
-
Android: GPU-accelerated ColorMatrix operations
- Hardware-accelerated bitmap processing
- Glide image loading with disk/memory caching
- Optimized for minimal memory footprint
- β Async processing on background threads
- β In-memory caching for frequently used images
- β Progressive image loading for remote URLs
- β Automatic memory management
- β Lazy initialization of GPU resources
- β Batch processing for multiple images
Processing a 4000x3000px image on iPhone 15 Pro / Pixel 8 Pro:
| Operation | iOS (Metal) | Android (GPU) |
|---|---|---|
| Apply filter | ~50ms | ~80ms |
| Real-time preview | 60 FPS | 60 FPS |
| Crop + Resize | ~30ms | ~40ms |
| Rotate 90Β° | ~20ms | ~25ms |
| Batch (5 images) | ~250ms | ~400ms |
Actual performance may vary based on device and image size.
- React Native: 0.74+ (New Architecture required)
- iOS: 18.0+ with Metal-capable device
- Android: API 33+ (Android 13+)
- Node.js: 20+
This library is built exclusively for the New Architecture. Make sure your app has the New Architecture enabled:
iOS: Set in Podfile:
use_frameworks! :linkage => :static
$RNNewArchEnabled = trueAndroid: Set in gradle.properties:
newArchEnabled=trueBuild error: "Cannot find Metal shader"
- Clean build folder:
Product > Clean Build Folderin Xcode - Delete
Podsfolder and runpod install
Runtime error: "Metal device not available"
- This library requires a Metal-capable device (iPhone 6s or later)
- Simulator support depends on your Mac's GPU
Build error: "Failed to resolve: react-native-image-filters"
- Run
./gradlew cleaninandroid/folder - Check that New Architecture is enabled in
gradle.properties
Runtime error: "Canvas: trying to use a recycled bitmap"
- This is fixed in version 1.0.0+
- Make sure you're using the latest version
A complete example app is included in the example/ directory demonstrating:
- β Real-time filter preview with intensity control
- β All document and photo filters
- β Interactive image cropping
- β Resize and rotate operations
- β Batch processing
- β Custom filter parameters
- β Show original image toggle
Run the example:
# Install dependencies
cd example
npm install
# iOS
cd ios && pod install && cd ..
npm run ios
# Android
npm run androidMIT License - see LICENSE file for details.
- Metal framework (Apple) for iOS GPU acceleration
- Android GPU ColorMatrix for Android acceleration
- React Native New Architecture team
- Glide library for Android image loading
- π Report a Bug
- π¬ Ask a Question
- π Read the API Docs
- π View Changelog
If you find this library helpful, consider supporting its development:
Made with β€οΈ for the React Native community


