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

FFI error: struct heif_decoding_options: wrong total size #84

Open
jinxinl2 opened this issue Apr 14, 2023 · 11 comments
Open

FFI error: struct heif_decoding_options: wrong total size #84

jinxinl2 opened this issue Apr 14, 2023 · 11 comments

Comments

@jinxinl2
Copy link

I'm trying to use the pyheif library to convert HEIC files to JPEG, but I'm encountering an issue with the heif_decoding_options struct. When calling pyheif.read() on a HEIC file, I get the following error:

ffi.error: struct heif_decoding_options: wrong total size (cdef says 48, but C compiler says 56). fix it or use "...;" as the last field in the cdef for struct heif_decoding_options to make it flexible

I have the latest versions of libheif and pyheif installed.

libheif: 1.15.2
pyheif: 0.7.1
python: 3.9
macOS: 13.2.1
Apple M2

Here's the code I'm using to read the HEIC file:

heif_file = pyheif.read(temp_file.name)

Could you please help me understand the cause of this error and how to fix it?

Thank you!

@bnavigator
Copy link

https://github.com/carsales/pyheif/blob/694c3b2538978047e6c3070a510c03be399bc542/libheif/heif.h needs to be synced with a recent libheif version.

@nak435
Copy link

nak435 commented Jun 15, 2023

ffi.error: struct heif_decoding_options: wrong total size (cdef says 48, but C compiler says 72). fix it or use "...;" as the last field in the cdef for struct heif_decoding_options to make it flexible
Same error occurred.

Please tell me how to update "heif.h".

M1 Mac
macOS 13.0
pthon 3.11
libheif 1.16.2
pyheif 0.7.1

I just copy it, "pip install pyheif" will cause an error in below.

build/temp.macosx-13-arm64-cpython-311/_libheif_cffi.c:3535:37: error: incomplete result type 'enum heif_color_profile_type' in function definition
static enum heif_color_profile_type _cffi_d_heif_image_get_color_profile_type(struct heif_image const * x0)
                                    ^
/opt/homebrew/include/libheif/heif.h:731:6: note: forward declaration of 'enum heif_color_profile_type'

Thanks

@bnavigator
Copy link

Apply #85

@homm
Copy link
Contributor

homm commented Jul 6, 2023

Fixed by #87

@jkclark
Copy link

jkclark commented Jul 25, 2023

I am still having this issue. Any update?

@hamzabidi
Copy link

hamzabidi commented Aug 10, 2023

Same problem for me ! Any update ?

installed libs on my alpine pods:

  • libheif-1.16.2-r0
  • libheif-dev-1.16.2-r0

@homm
Copy link
Contributor

homm commented Aug 23, 2023

You can install from master until the new version will be released:

$ pip install git+https://github.com/carsales/pyheif.git@master#egg=pyheif

@moritaYutaroo
Copy link

What versions of python, pyheif, and libheif should I install and use?
I could not use the following versions with an error.

python:3.9.5
pyheif:0.7.1
libheif:1.17.6
Error: p_options.ignore_transformations = int(not heif_file.apply_transformations)
ffi.error: struct heif_decoding_options: wrong total size (cdef says 48, but C compiler says 72). fix it or use "... ;" as the last field in the cdef for struct heif_decoding_options to make it flexible

@gwynnebaer
Copy link

gwynnebaer commented May 20, 2024

Same error as @moritaYutaroo.

M1 Apple Silicon
Python 3.11.6
pheif: 0.7.1
libheif: 1.17.6

ffi.error: struct heif_decoding_options: wrong total size (cdef says 48, but C compiler says 72). fix it or use "...;" as the last field in the cdef for struct heif_decoding_options to make it flexible

Install from master branch fails with many errors.

@mzahidriaz
Copy link

https://pypi.org/project/pillow-heif/
This library works, I am no longer seeing above error

@vasugupta9
Copy link

https://pypi.org/project/pillow-heif/ This library works, I am no longer seeing above error

thanks , this works !

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

Successfully merging a pull request may close this issue.

10 participants