margelo / margelo/react-native-vision-camera
✨ Expose photo capture format capabilities (RAW / Apple ProRAW support) to JS
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 9.6k
- Forks
- 1.4k
- Avg merge
- 1d 28m
- Merged PRs (30d)
- 4
Description
Prerequisites
- I have searched existing issues for a similar request.
What problem are you trying to solve?
I need a way to query, from JS, whether the current camera device/photo output supports RAW capture before attempting it — ideally distinguishing Apple ProRAW from Bayer RAW on iOS. For example:
CameraDevice.supportedPhotoContainerFormats: PhotoContainerFormat[], and/or
readonly properties on CameraPhotoOutput, e.g. supportsProRawCapture / supportsRawCapture, valid once the output is connected to a session
In V5, containerFormat must be configured upfront when creating a photo output via usePhotoOutput(...). There is currently no API to know whether 'dng' will actually work on the current device — capture simply rejects at runtime with:
"This PhotoOutput does not support raw capture ("dng" format)! Select a Format that contains dng in its supportedPhotoContainerFormats to capture raw photos."
Notably, the error message already refers to a supportedPhotoContainerFormats API that doesn't exist yet, and src/specs/outputs/CameraPhotoOutput.nitro.ts contains a TODO acknowledging the gap:
// TODO: I think there is no way to get 'containerFormat' upfront - we dont know what formats are supported! We need to expose that probably via 'CameraDevice.supportedPhotoContainerFormats'
Without this, apps that offer a RAW/JPEG toggle in their UI cannot decide whether to show the toggle at all. This matters because RAW availability varies significantly by hardware: Apple ProRAW is only available on Pro-model iPhones, and Bayer RAW is unavailable on virtual multi-cam devices (e.g. the dual/triple back camera) and the front camera. The only current workarounds are device-model heuristics or capturing and catching the error.
Proposed API / solution
On iOS the implementation appears straightforward — once the AVCapturePhotoOutput is connected to the session, the information is available natively:
- ProRAW:
AVCapturePhotoOutput.isAppleProRAWSupported - Bayer RAW:
availableRawPhotoPixelFormatTypesfiltered withAVCapturePhotoOutput.isBayerRAWPixelFormat(_:)
Alternatives considered
device-model heuristics via the device name (fragile across new models), a separate native module that spins up a throwaway AVCaptureSession just to read isAppleProRAWSupported (works, but duplicates session setup), and patching the library (requires regenerating Nitro bridges on every upgrade).
Platforms this should target
iOS
Would you be willing to contribute this?
Maybe, with guidance.
Additional context
I already implemented this functionality in my own fork of vision-camera v4, but would prefer not to fork the library again.
Submission
- I described the problem, not just the solution.
- I wrote this request in my own words. I did not paste AI-generated proposals.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading src/specs/outputs/CameraPhotoOutput.nitro.ts and its TODO about exposing supportedPhotoContainerFormats. Trace the iOS AVCapturePhotoOutput integration, then expose ProRAW and Bayer RAW capabilities to JS and verify that apps can query them before capture.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react, typescript
- Domain
- api, mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100