Skip to content

feat: add Base64 image encoding - #177

Merged
mrousavy merged 2 commits into
mainfrom
feat/image-base64
Aug 25, 2026
Merged

feat: add Base64 image encoding#177
mrousavy merged 2 commits into
mainfrom
feat/image-base64

Conversation

@mrousavy

Copy link
Copy Markdown
Owner

Summary

  • add Image.toBase64Async(format, quality?) with a documented standard, padded Base64 contract
  • encode directly from native UIImage and Bitmap off the caller thread, without an intermediate JS ArrayBuffer
  • regenerate Nitro bindings and document data URL usage and binary-data tradeoffs
  • add harness coverage for output shape, byte equality, image roundtripping, defaults, quality rounding, and errors

Tests

  • bun run typecheck
  • bun run lint-ci
  • cd packages/react-native-nitro-image && bun run build
  • cd packages/react-native-nitro-image && bun run specs
  • ./gradlew :react-native-nitro-image:compileDebugKotlin --no-daemon
  • ./gradlew app:assembleDebug -PreactNativeArchitectures=arm64-v8a --no-daemon
  • iOS NitroImage library scheme build for the iPhone 17 Pro simulator
  • bun example test:harness __tests__/image-encoding.harness.ts --harnessRunner android-device on a physical Android device - 16 tests passed

Notes

The iOS library target builds successfully. The local example app link is currently blocked by framework React not found before it can run, so iOS runtime harness coverage is left to CI.

This adds a required method to HybridImageSpec. Existing iOS types conforming through NativeImage receive the default implementation.

Closes #174

Comment thread README.md Outdated
Co-authored-by: Marc Rousavy <me@mrousavy.com>
@mrousavy
mrousavy merged commit 0d5fb00 into main Aug 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No native base64 for encoded image data

1 participant