ionic-team / ionic-team/capacitor-camera

[Bug]: targetHeight/targetWidth has no effect on Gallery Images

Open
#48 1 comment 0 reactions 1 assignee Claimed by @andredestro View on GitHub
Dominant language
TypeScript
Stars
4
Forks
1
Avg merge
2d 1h
Merged PRs (30d)
2

Description

### Current Behavior

When using Camera.chooseFromGallery with targetHeight and targetWidth the Resolution and Filesize will be different than using the deprecated .pickImages.
```
const { results } = await Camera.chooseFromGallery({
quality: 80,
targetHeight: 1920,
targetWidth: 1920,
mediaType: MediaTypeSelection.Photo,
allowMultipleSelection: true,
limit: 5,
});
```
Will result in having a thumbnail with the resolution of 1080x1440 with a filesize of 1.12MB. When using the uri of the taken images it will have the full resolution of the Image (in my Case 3000x4000 with 3.65MB).

Before when using this code:
```
const { photos } = await Camera.pickImages({
quality: 80,
height: 1920,
width: 1920,
limit: 5,
});
```
The Image Resolution would be 1440×1920 with a Filesize of 427.73KB

### Expected Behavior

The resolution should be adjusted to the given targetHeight and targetWidth while respecting the original aspect ratio.

### Reproduction

https://github.com/ionic-team/capacitor-camera/tree/main/example-app

### Screenshots / Media

_No response_

### Environment Details

```Shell
Latest Dependencies:

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

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/cli: 8.3.1
@capacitor/android: 8.3.1
@capacitor/core: 8.3.1
```

### Versions Affected

8.1.0"

### Platforms Affected

- [ ] iOS
- [x] Android
- [ ] Web

### Notes / Comments

When using the example-app project from capacitor-camera the effect is also noticable. Set the Height and Width to 100/200 and try to load a Image from Gallery.

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.