ionic-team / ionic-team/capacitor-camera

Camera.takePhoto method ignores the targetWidth and targetHeight options

Open
#70 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4
Forks
1
Avg merge
2d 1h
Merged PRs (30d)
2

Description

## Bug Report

### Plugin(s)
@capacitor/camera 8.0.2

### Capacitor Version

```
Capacitor Doctor

Latest Dependencies:

@capacitor/cli: 8.5.0
@capacitor/core: 8.5.0
@capacitor/android: 8.5.0
@capacitor/ios: 8.5.0

Installed Dependencies:

@capacitor/cli: 8.4.0
@capacitor/core: 8.4.0
@capacitor/ios: 8.4.0
@capacitor/android: 8.4.0

[success] Android looking great!
```

### Platform(s)
Android. Did not test on iOS.

### Current Behavior
The new takePhoto method ignores the new targetWidth and targetHeight options.

### Expected Behavior
The resulting image should have a resolution that matches the targetWidth and targetHeight specified in the Camera.takePhoto method.

### Code Reproduction
```
const imageResult: MediaResult = await Camera.takePhoto({
quality: 80,
editable: "no",
includeMetadata: true,
cameraDirection: CameraDirection.Rear,
correctOrientation: true,
targetWidth: 1024,
targetHeight: 768
})
const fileResult: ReadFileResult = await Filesystem.readFile({ path: imageResult.uri })
/* examining the data in fileResult.data gives an image with a resolution of 3456x4608 */
/* rather than the requested resolution of 1024x768 */
```

### Other Technical Details

### Additional Context

Contributor guide

Open the contributing guide

Research direction

Start at the Camera.takePhoto entry point and run the provided Android reproduction with targetWidth 1024 and targetHeight 768. Trace how those options are handled on Android, then verify that the resulting image dimensions match the requested values.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, typescript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.