Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

khitrin
Copy link
Contributor

@khitrin khitrin commented Jan 13, 2024

BREAKING CHANGE: automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current

Thanks for submitting a PR! Please read these instructions carefully:

  • Explain the motivation for making this change.
  • Provide a test plan demonstrating that the code is solid.
  • Match the code formatting of the rest of the codebase.
  • Target the main branch, NOT a "stable" branch.

Motivation (required)

Some Android phones (Samsung for example) take photos in HEIC format like iPhones.
The library converts HEIC to JPEG on iOS using preferredAssetRepresentationMode, but the Android picker seems to lack this ability.
Sharing unconverted HEICs is very inconvenient because many clients cannot display them.

The change adds an ability to the library to mimic the iOS behaviour and convert selected HEIC files to JPEG on Android.
Support for preferredAssetRepresentationMode option has been added to Android to provide an opt-out for this conversion working exactly the same as on iOS. If a user wants to select the original file they can set it to "current" as they already do on iOS.

Also conversionQuality option has been added to set the desired quality of converted images because existing quality option must be set to 1 to avoid JPEG-to-JPEG conversion. Default value 92 is chosen as same to the ImageMagick defaults.

Test Plan (required)

  1. Add a HEIC file to the gallery (or take a photo on Samsung).
  2. Select image using unchanged Example App.
    before
  3. Type of the image is "image/heic", extension of uri is ".heic".
  4. Apply patch, recompile and update the app, select the same image.
    after
  5. Type of the image is "image/jpeg", extension of uri is ".jpg", fileSize is slightly increased.

BREAKING CHANGE: automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
Copy link

@SveBo SveBo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a short and good solution, works perfectly.

@sjchristi
Copy link

Having issues with newer samsung phones saving in HEIC; would love to see this integrated.

@Nantris
Copy link

Nantris commented Dec 11, 2024

Friendly bump. Currently HEIC seems basically impossible to manage in React Native but certainly users expect it to "just work."

@sjchristi
Copy link

been using khitrin's branch in production and it's been fine.

now we're being forced to update our android to use the photo picker. could someone please merge this?

@Johan-dutoit Johan-dutoit merged commit 9df11bc into react-native-image-picker:main Feb 1, 2025
Johan-dutoit pushed a commit that referenced this pull request Feb 1, 2025
# [8.0.0](v7.2.3...v8.0.0) (2025-02-01)

* feat(android)!: convert HEIC to JPEG (#2264) ([9df11bc](9df11bc)), closes [#2264](#2264)

### BREAKING CHANGES

* automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
@Johan-dutoit
Copy link
Collaborator

🎉 This PR is included in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@andidev
Copy link
Contributor

andidev commented Feb 14, 2025

Hmm think "image/heif" support would be nice as well. my camera saved it as image/heif on my phone.
will create a pr for it.

andidev added a commit to andidev/react-native-image-picker that referenced this pull request Feb 14, 2025
andidev added a commit to andidev/react-native-image-picker that referenced this pull request Feb 14, 2025
Johan-dutoit pushed a commit that referenced this pull request Feb 16, 2025
# [8.1.0](v8.0.0...v8.1.0) (2025-02-16)

### Features

* add support for converting image/heif to jpeg relates to [#2264](#2264) ([#2357](#2357)) ([ce350a1](ce350a1))
Cactueonicle added a commit to Cactueonicle/improvements that referenced this pull request Aug 13, 2025
# [8.0.0](react-native-image-picker/react-native-image-picker@v7.2.3...v8.0.0) (2025-02-01)

* feat(android)!: convert HEIC to JPEG (#2264) ([9df11bc](react-native-image-picker/react-native-image-picker@9df11bc)), closes [#2264](react-native-image-picker/react-native-image-picker#2264)

### BREAKING CHANGES

* automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
Cactueonicle added a commit to Cactueonicle/improvements that referenced this pull request Aug 13, 2025
TideTrackerDev added a commit to TideTrackerDev/convexification that referenced this pull request Aug 25, 2025
# [8.0.0](react-native-image-picker/react-native-image-picker@v7.2.3...v8.0.0) (2025-02-01)

* feat(android)!: convert HEIC to JPEG (#2264) ([9df11bc](react-native-image-picker/react-native-image-picker@9df11bc)), closes [#2264](react-native-image-picker/react-native-image-picker#2264)

### BREAKING CHANGES

* automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
TideTrackerDev added a commit to TideTrackerDev/convexification that referenced this pull request Aug 25, 2025
MarlowerThorne added a commit to MarlowerThorne/congenia that referenced this pull request Sep 17, 2025
# [8.0.0](react-native-image-picker/react-native-image-picker@v7.2.3...v8.0.0) (2025-02-01)

* feat(android)!: convert HEIC to JPEG (#2264) ([9df11bc](react-native-image-picker/react-native-image-picker@9df11bc)), closes [#2264](react-native-image-picker/react-native-image-picker#2264)

### BREAKING CHANGES

* automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
MarlowerThorne added a commit to MarlowerThorne/congenia that referenced this pull request Sep 17, 2025
AsasReed added a commit to AsasReed/friened that referenced this pull request Sep 18, 2025
# [8.0.0](react-native-image-picker/react-native-image-picker@v7.2.3...v8.0.0) (2025-02-01)

* feat(android)!: convert HEIC to JPEG (#2264) ([9df11bc](react-native-image-picker/react-native-image-picker@9df11bc)), closes [#2264](react-native-image-picker/react-native-image-picker#2264)

### BREAKING CHANGES

* automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
AsasReed added a commit to AsasReed/friened that referenced this pull request Sep 18, 2025
gngseb added a commit to gngseb/Nemeth that referenced this pull request Oct 7, 2025
# [8.0.0](react-native-image-picker/react-native-image-picker@v7.2.3...v8.0.0) (2025-02-01)

* feat(android)!: convert HEIC to JPEG (#2264) ([9df11bc](react-native-image-picker/react-native-image-picker@9df11bc)), closes [#2264](react-native-image-picker/react-native-image-picker#2264)

### BREAKING CHANGES

* automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
iceVeges added a commit to iceVeges/uws4vad that referenced this pull request Oct 15, 2025
# [8.0.0](react-native-image-picker/react-native-image-picker@v7.2.3...v8.0.0) (2025-02-01)

* feat(android)!: convert HEIC to JPEG (#2264) ([9df11bc](react-native-image-picker/react-native-image-picker@9df11bc)), closes [#2264](react-native-image-picker/react-native-image-picker#2264)

### BREAKING CHANGES

* automatically convert HEIC files to JPEG on Android if assetRepresentationMode is not set to current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.