Skip to content

feat: Add onThumbnailReady callback for photo capture#3646

Closed
MikaelAmborn wants to merge 1 commit intomrousavy:mainfrom
SecondHandHelper:feat/thumbnail-callback
Closed

feat: Add onThumbnailReady callback for photo capture#3646
MikaelAmborn wants to merge 1 commit intomrousavy:mainfrom
SecondHandHelper:feat/thumbnail-callback

Conversation

@MikaelAmborn
Copy link
Copy Markdown

What

Add support for generating thumbnails during photo capture with an asynchronous callback that fires before the full photo is saved. This enables fast preview functionality without loading the full image.

Changes

  • Add thumbnailSize and onThumbnailReady options to TakePhotoOptions
  • Add ThumbnailFile type for thumbnail metadata
  • iOS: Extract embedded thumbnail from AVCapturePhoto using ImageIO
  • Android: Implement memory-efficient downsampling with hardware-accelerated decoding
  • Add event bridge onThumbnailReady for both platforms
  • Update documentation with usage examples and platform implementation details
  • Add thumbnail display in example app

Platform implementations

  • iOS: Uses embedded thumbnail from camera capture if available
  • Android: Uses BitmapFactory.Options.inSampleSize for efficient downsampling without loading full image into memory

Both implementations are asynchronous and non-blocking.

Disclaimer: I'm not an iOS or Android developer but have relied on Cursor to implement this.

Tested on

iPhone 14, iOS 18.6.2
Android implementation compiles successfully (needs device testing)

Add support for generating thumbnails during photo capture with an
asynchronous callback that fires before the full photo is saved. This
enables instant preview functionality and better UX in camera
applications.

**Changes:**
- Add `thumbnailSize` and `onThumbnailReady` options to
  `TakePhotoOptions`
- Add `ThumbnailFile` type for thumbnail metadata
- iOS: Extract embedded thumbnail from AVCapturePhoto using ImageIO for
  maximum performance
- Android: Implement memory-efficient downsampling with
  hardware-accelerated decoding
- Add event bridge `onThumbnailReady` for both platforms
- Update documentation with usage examples and platform implementation
  details
- Add thumbnail display in example app

**Platform implementations:**
- iOS: Uses embedded thumbnail from camera capture if available
- Android: Uses BitmapFactory.Options.inSampleSize for efficient
  downsampling without loading full image into memory

Both implementations are asynchronous and non-blocking.

Tested on iPhone 14, iOS 18.6.2
Android implementation compiles successfully (needs device testing)
@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 14, 2025

@MikaelAmborn is attempting to deploy a commit to the mrousavy's Team Team on Vercel.

A member of the Team first needs to authorize it.

@mrousavy
Copy link
Copy Markdown
Owner

Hey - thanks for your PR, I really appreciate it! And sorry for not replying sooner, I was hyper-focused on VisionCamera V5.

Exciting news: I believe this is now obsolete, as VisionCamera V5 now supports this! 🥳
I'm closing this PR, but please let me know if this is still not working as intented in V5 and we can open a new issue for discussion, or possibly a PR already with a fix.

@mrousavy mrousavy closed this Apr 21, 2026
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.

2 participants