hnc-rn-image-overlay
v1.0.13
Published
Native module to add overlay and text watermark to images for React Native
Maintainers
Readme
hnc-rn-image-overlay
Native module to add white overlay with text watermark to images on iOS and Android.
Features
- ✅ Native performance - No JavaScript bridge for image processing
- ✅ Multiple text lines - Support for any number of text lines
- ✅ Auto-scaling - Font size automatically scales based on image dimensions
- ✅ EXIF orientation handling - Correctly handles rotated images (Android)
- ✅ Modern native code - Written in Swift (iOS) and Kotlin (Android)
- ✅ TypeScript support - Fully typed API
Installation
npm install hnc-rn-image-overlay
# or
yarn add hnc-rn-image-overlayiOS
cd ios && pod installAndroid
No additional steps required. Auto-linking will handle the setup.
Usage
import ImageOverlayModule from 'hnc-rn-image-overlay';
const processImage = async () => {
try {
const imagePath = '/path/to/image.jpg';
const textLines = [
'🕕 John Doe - 14:30 14/01/2026',
'📍 123 Main Street, Hanoi, Vietnam'
];
const resultPath = await ImageOverlayModule.addOverlayAndText(
imagePath,
textLines
);
console.log('Processed image:', resultPath);
} catch (error) {
console.error('Failed to process image:', error);
}
};API
addOverlayAndText(imagePath: string, textLines: string[]): Promise<string>
Adds a white semi-transparent overlay with text to an image.
Parameters:
imagePath(string) - Absolute path to the input imagetextLines(string[]) - Array of text strings to render on the overlay
Returns:
Promise<string>- Resolves to the output image path (in cache directory)
Technical Details
Overlay Specifications
- Position: Bottom of the image
- Color: White with 75% opacity
- Text color: Black
- Font: System default
- Font size: Automatically calculated based on image size
- Output format: JPEG with 100% quality
Image Processing
Android:
- Reads EXIF orientation data and applies rotation before processing
- Handles all EXIF orientation values (1-8)
iOS:
- Uses Core Graphics (UIKit) for drawing
License
MIT
Credits
Developed by HopNhat Team.
