apache / apache/cordova-plugin-camera

PNG getting Converted to JPG when selecting Images from Gallery

Open
#927 4 comments 0 reactions 0 assignees View on GitHub
Needs Triange/Confirmation
Dominant language
Objective-C
Stars
976
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

When using the Cordova Camera plugin with the encodingType option as JPEG,

I noticed that when selecting a PNG image from the gallery, the plugin modifies both the file name and type, converting the image to JPG if any scaling or modifications are applied.

### Expected Behavior:

- The file name may change due to processing, but the original image format (PNG) should be retained unless explicitly converted by the user.

### Observed Behavior:

- When a PNG image is selected, the plugin automatically converts it to JPG after applying modifications (e.g., scaling).
- The encoding type seems to be applied regardless of the source image format, leading to unexpected format conversion.

### Questions:

- Is this the expected behavior?
- Is there a specific reason for converting PNG images to JPG?
- Can the plugin be modified to retain the original image format when selecting images from the gallery?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Cordova Camera plugin's gallery-selection path and how encodingType is applied when scaling or modifying an image. Reproduce the PNG-selection case, then verify that the output keeps PNG format and naming unless the user explicitly requests JPEG conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.