Work toward a byte budget
Set a JPEG or WebP target with maxBytes. Check the returned size before upload; an unreachable target returns the smallest candidate.
React Native Image Compression Kit
Compress, resize, and convert local images on Android and iOS. Set a byte target, choose a metadata policy, and keep native work bounded.
npm install react-native-image-compression-kitMIT licensed · TypeScript API · Native codecs
One recorded example
A local JPEG, resized and compressed on Android.
86.8% smaller filein this sample, including resizing
JPEG quality up to 90 · target 500 kB · metadata stripped
Recorded with a synthetic test image on native runtimes. Results vary by image and device. This page does not upload or compress your files.
Captured from the 0.4.1 source candidate. Published npm latest is 0.4.0.
Release status
npm latest: 0.4.0 · source candidate: 0.4.1. The published iOS renderer can vertically invert output pixels. The candidate fixes orientation and adds package-owned output cleanup. The example above is a recorded source-tree result, not a claim that those fixes are in npm. Review the release notes.
import { compressImage } from 'react-native-image-compression-kit';
async function compressLocalImage(localImageUri: string) {
return compressImage({
source: { uri: localImageUri },
resize: { maxWidth: 1600, maxHeight: 1600, mode: 'contain' },
output: { format: 'jpeg', quality: 82 },
metadata: 'safe',
});
}Get back a cache URI, dimensions, and byte counts. Your source image stays unchanged. Install, rebuild, and handle the result.
Set a JPEG or WebP target with maxBytes. Check the returned size before upload; an unreachable target returns the smallest candidate.
Discover codecs and limits on the device. Decode downsampling, two-operation scheduling, and cancellation keep native work bounded.
Choose a metadata policy. Upload or preserve the new cache file, then remove the temporary output. Gallery sources are never deleted.
| Your task | Start here |
|---|---|
| Add compression to an app | Quick start |
| Compare native output or generate request code | Interactive demo |
| Decide whether this fits your pipeline | Pipeline selection guide |
| Estimate your own transfer and storage scenario | Byte economics calculator |
| Check supported formats and framework versions | Capabilities · Compatibility |
MIT licensed and built around a small TypeScript API. The package processes local images on Android and iOS; it does not provide a picker, upload client, or browser codec. Expo requires a development build; Expo Go is unsupported.
Explore the architecture and roadmap, ask an integration question in Discussions, or follow the contribution guide to report a reproducible bug or improve the docs.