Skip to content

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

@maxsteinwand

Description

@maxsteinwand

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

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
  • 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions