capacitor-community / capacitor-community/camera-preview

Issue: CameraPreview.capture() ignores requested dimensions, defaulting to initialization resolution

Open
#374 2 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
227
Forks
185
PR merge metrics
No merged PRs in 30d

Description

# CameraPreview.capture() ignores requested dimensions, defaulting to initialization resolution

## Description
The `CameraPreview.capture()` method ignores the explicitly requested dimensions (2048x2048) and instead captures images at the resolution specified during initialization (1024x1024). This prevents capturing higher resolution photos than what was initially set up.

## Expected Behavior
When calling `CameraPreview.capture()` with specified dimensions of 2048x2048, the plugin should capture images at this higher resolution, regardless of the initialization settings.

## Actual Behavior
The plugin captures images at the resolution specified during initialization (1024x1024) and completely ignores the parameters passed to the `capture()` method. This makes it impossible to dynamically request higher-quality captures at runtime.

## Reproduction Steps
1. Initialize CameraPreview with `width: 1024, height: 1024`
2. Call `capture()` with `width: 2048, height: 2048, quality: 90`
3. Check the dimensions of the returned image
4. Note that the dimensions are 1024x1024, matching the initialization parameters rather than the capture parameters

## Technical Details
The plugin appears to establish the capture resolution at initialization time and does not allow it to be changed during runtime through the `capture()` method parameters. This severely limits the flexibility of the plugin for applications that need to adjust capture quality dynamically.

## Possible Solutions
1. Modify the plugin to respect the dimensions passed to the `capture()` method, overriding the initialization settings
2. Add a separate method to update capture resolution at runtime before capturing
3. Document this limitation clearly if it's an intentional design decision

## Environment
- Capacitor CameraPreview plugin version: [7.0.0]
- iOS version: [17]
- Device tested: iPhone [14]
- Safar (PWA)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.