Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error when try to convert a HEIC file from iphone 15 Pro/ Pro Max with iOS 18 #61

Open
jlTorresAdCentral opened this issue Sep 23, 2024 · 13 comments

Comments

@jlTorresAdCentral
Copy link

heif_error_code_heif_error_Invalid_input

Error converting HEIC to jpeg: {code: 2, message: 'ERR_LIBHEIF format not supported'}

@MNU-497
Copy link

MNU-497 commented Sep 25, 2024

I can confirm this error on our platform as well. A typical heif image from an iPhone running IOS 18 was taken today and tested against the library alexcorvi/heic2any, and it failed to convert.

@AJLoveChina
Copy link

The issue is resolved in strukturag/libheif#1190

@alexcorvi we need to rebuild the libheif.js

@mvn-sinhtao-dn
Copy link

The issue is resolved in strukturag/libheif#1190

@alexcorvi we need to rebuild the libheif.js

Hi @alexcorvi , @AJLoveChina

Thanks a lot for providing the useful library that our digital product has been using over the months.

We've recently received several reports from our customers saying it's failed to proceed the photos taken by their iPhone15 Pro under iOS18.
We try reproducing the issue on the following iOS devices and confirm it failed to convert HEIC photos taken from iPhone 15 Pro running iOS:
• 16pro iOS 18.0 4G → 100% OK
• 15pro iOS 17.4 4G → 100% OK
• 15pro iOS 18.0 4G → 3 OK, 7 Error
• 15pro iOS 18.0 4G → 3 OK, 7 Error
• 15pro iOS 18.0 4G → 1 OK, 6 Error
• 15plus iOS 17.6.1 Wifi → 100% OK
• 15plus iOS 17.6.1 Wifi → 100% OK
• 14 iOS 18.0 4G → 100% OK
• 13pro iOS 17.6.1 4G → 100% OK
• 11 iOS 18.0 Wifi → 100% OK
• 8plus iOS 15.2 Wifi → 100% OK
• iPad4 iOS 18.0 Wifi → 100% OK

As converting HEIC photos is an important step to our product, and to void impacts to our customers as much as possible, could you please consider rebuilding the lib?
Or share with us your plan on rebuilding the lib, if possible?

Looking forwards to receiving your reply.
Thanks in advance!

@AJLoveChina
Copy link

AJLoveChina commented Oct 6, 2024

Hi @mvn-sinhtao-dn , I create a solution based on libheif, using wasm to convert heic format image. It's about 20% faster than pure javascript. And it supports heic from IOS 18

Here is the library : https://github.com/AJLoveChina/libheic

@mvn-sinhtao-dn
Copy link

Hi @AJLoveChina

Thanks a lot for your response!
I'll give it a try and let you know the result once it's done.

@phuviet
Copy link

phuviet commented Oct 8, 2024

Hi @AJLoveChina

Thanks for your solution
We're using NextJS 14 and have tried your solution, but it doesn't seem to work for us. Here is our code:

// import 
import { HeifConvert } from '@/assets/js/convert';
import { libheif } from '@/assets/js/libheif';

// usage
const wasm = await fetch('/libheif.wasm');
if (!wasm.ok) {
  throw new Error(`HTTP error! status: ${wasm.status}`);
}

const wasmBinary = await wasm.arrayBuffer();
console.log(wasmBinary, 'wasmBinary');                              --> console.log 1

const heic = new HeifConvert(libheif({ wasmBinary }));
console.log(heic, 'heic');                                          --> console.log 2

The console.log 1 works fine and displays the wasmBinary's value, but console.log 2 doesn’t show anything. It seems there is an error when calling new HeifConvert(libheif({ wasmBinary })).
Could you let us know if you have any insights on using it with NextJS 14? Thanks a lot 🙇

@AJLoveChina
Copy link

HI @phuviet , can you attach the error picture? And we should export HeifConvert in convert.js, because there is no export statement in convert.js

@mvn-vietnguyen-dn
Copy link

@AJLoveChina

HI @phuviet , can you attach the error picture? And we should export HeifConvert in convert.js, because there is no export statement in convert.js

I have exported HeifConvert from convert.js and as I mentioned before, there are no errors in the console. It just not work 🤔

image

@mvn-vietnguyen-dn
Copy link

mvn-vietnguyen-dn commented Oct 15, 2024

@AJLoveChina

After checking many times, I realized that this code works fine on iOS mobile devices (current is iPhone 11 Pro) but does not work on Android or MacBook devices. You can check the images below for the error.

image

On android device
image

@LaurineLeNet
Copy link

Hi ! I am facing the same issue :
image
Do you know when this issue will be fixed ?
Thank you !

@yetza1000
Copy link

Any updates on when we can expect a new release to address this issue?

@AJLoveChina
Copy link

AJLoveChina commented Oct 31, 2024

@mvn-vietnguyen-dn it looks fine on my android/macPro device. Have you tried my demo on your device?

ajlovechina.github.io/libheic/

image

image

@CanadianN1nj4
Copy link

CanadianN1nj4 commented Dec 4, 2024

I believe for this to be fixed for the library, we'd just need an updated libheif.js file in src/libheif.js with the updated libheif version that fixes this issues with iOS 18. I don't have the necessary skills to replace the libheif.js with what it should be, as I believe it comes from a thing called emscripten, but not sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants