Skip to content

v0.4.0

Latest

Choose a tag to compare

@github-actions github-actions released this 20 Jul 11:13
Immutable release. Only release title and notes can be modified.
6841a88

React Native Image Compression Kit v0.4.0

This release makes large-image compression resilient to memory pressure and
moves native work off the React Native and main-thread execution paths while
preserving existing compressImage(options) calls.

Highlights

  • Bounded native execution with at most two concurrent compression operations
    on Android and iOS.
  • Decode-time downsampling through BitmapFactory.inSampleSize,
    ImageDecoder.setTargetSize, and ImageIO thumbnails.
  • Pre-decode source and working-pixel limits with stable
    ERR_RESOURCE_LIMIT failures instead of unbounded full-resolution decode.
  • Optional AbortSignal-compatible cancellation with stable ERR_CANCELLED
    behavior for preflight, queued, and running work.
  • Transactional cache output that removes incomplete or cancellation-losing
    files and only returns fully published results.
  • Cross-platform JPEG transparency flattening and decode-back-validated PNG and
    WebP alpha capabilities.

Install

npm install react-native-image-compression-kit@0.4.0

Android requires API 23 or newer and iOS requires 13.4 or newer. Expo requires
a development build or prebuild; Expo Go and Snack remain unsupported.

Public API

Existing calls remain valid:

const result = await compressImage(options);

Cancellation is additive:

const controller = new AbortController();
const pending = compressImage(options, { signal: controller.signal });
controller.abort();
await pending;

getImageCompressionCapabilities() now also reports bounded concurrency,
decode-downsampling support, cancellation support, and named source/working
pixel limits.

Resource policy

  • Maximum source dimension: 32,768 pixels per axis.
  • Maximum source pixels: 100,000,000.
  • Maximum required decoded working pixels: 25,000,000.
  • Large sources remain supported when resize bounds permit safe decode-time
    downsampling below the working limit.

Validation

  • 364 JavaScript and TypeScript contract tests.
  • 75 Android native unit tests plus emulator codec validation.
  • 945 iOS native assertions including a real 8000×6000 JPEG.
  • React Native 0.73.11 Legacy, React Native 0.86 Legacy/New Architecture, and
    Expo 57 development-build consumers on Android and iOS.
  • Alpha round-trip, target-size cancellation, queue saturation, settle-once,
    and output-cleanup coverage.

Known limitations

  • HEIC, HEIF, and AVIF output are not implemented.
  • Animation preservation, batch compression, and progress events are not
    implemented.
  • Remote URLs and data URIs remain outside the local-source contract.
  • WebP and modern input codecs remain runtime capability gated.
  • Successful cache files remain application-owned after return.

Full changes are in CHANGELOG.md. Registry provenance and
review evidence are imported after the exact published artifact passes Trusted
Release validation.