apache / apache/cordova-plugin-camera
correctOrientation: true is ignored for encodingType: PNG
- Dominant language
- Objective-C
- Stars
- 976
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
`camera.getPicture` with `correctOrientation: true` works for `Camera.EncodingType.JPEG`, but not for `Camera.EncodingType.PNG`.
### What is expected to happen?
Consider the following call:
```ts
camera.getPicture(
{
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.PNG,
mediaType: Camera.MediaType.PICTURE,
allowEdit: false,
correctOrientation: true, // !
quality: 100,
},
(rawFileUrl: string) => { /* ... */ },
(error: unknown) => { /* ... */ },
);
```
Because of `correctOrientation: true`, I expect the returned image to be rotated correctly, depending on how I hold the phone while taking the picture.
### What does actually happen?
The returned picture is always in landscape mode. Depending on how I hold the phone, it's (wrongly) rotated by 90° or even 180°.
## Information
Rotation works correctly for `Camera.EncodingType.JPEG`.
### Environment, Platform, Device
Galaxy S24 with Android 16
### Version information
Cordova 13, cordova-plugin-camera 8.0.0
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start at the Android implementation of camera.getPicture and trace how correctOrientation behaves for JPEG versus PNG. Reproduce the supplied PNG configuration on an Android device, then compare its output with JPEG and inspect the relevant Android tests, if present. Done means PNG output honors correctOrientation without regressing JPEG behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 63/100