-
Notifications
You must be signed in to change notification settings - Fork 41
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
Struct heif_decoding_options: wrong total size #92
Comments
I'm having the same issue running this on macOS py3.11.5
|
I'm having same problem as CyberFit. ➜ brew info libffi
==> libffi: stable 3.4.4 (bottled), HEAD [keg-only]
Portable Foreign Function Interface library
https://sourceware.org/libffi/
/opt/homebrew/Cellar/libffi/3.4.4 (17 files, 724.8KB)
Poured from bottle using the formulae.brew.sh API on 2023-08-15 at 08:48:22
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/lib/libffi.rb
License: MIT
==> Options
--HEAD
Install HEAD version
==> Caveats
libffi is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find libffi you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
==> Analytics
install: 27,321 (30 days), 71,475 (90 days), 188,609 (365 days)
install-on-request: 6,790 (30 days), 17,520 (90 days), 43,862 (365 days)
build-error: 1 (30 days)
|
Same error on slightly older Python. The file in question is a recent HEIC from an iPhone running iOS 16.6.1.
|
This is probably a duplicate of #84 -- installing from master as directed in that issue resolves the problem. |
when installing from master on M1 old error has returned |
I have the same problem as @davidcz95 |
For anyone still on this thread, I found at least a temporary workaround using the pillow_heif module. from pillow_heif import register_heif_opener
from PIL import Image
register_heif_opener()
def load_heic_image(heic_file_path):
# obtain the image data
image = Image.open(heic_file_path)
return image
# Replace with your HEIC file path
heic_file_path = 'foo.heic'
image = load_heic_image(heic_file_path) Hope this helps. |
Another workaround (installing from this repo didn't work for me because it would try to build against an incompatible version of libheif) is to downgrade to Python 3.11. I had upgraded to Python 3.12 but there is no pyheif wheel for it. |
I finally found another way to do it ! ` from PIL import Image from src.utils.mimes_type_enum import MimeTypeEnum SOURCE_EXTENSION: Final[str] = 'heic' async def convert_to_png(file: UploadFile) -> UploadFile:
` I use the Thank you @malekinho8 for the idea ;) |
This worked |
In a fastapi project, i have this method:
When I run it locally (ubuntu 22 LTS), I get no errors. But when I deploy it on a container based on the python:3.8-alpine image, I get this error:
File '/home/python/app/src/api/api_v1/endpoints/dossier.py', line 195, in dossier_piece_post file, content_type = FileService.ios_image_converter(file) File '/home/python/app/src/api/api_v1/services/FileService.py', line 57, in ios_image_converter heif_file = pyheif.read(file.file.read()) File '/usr/local/lib/python3.8/site-packages/pyheif/reader.py', line 103, in read return heif_file.load() File '/usr/local/lib/python3.8/site-packages/pyheif/reader.py', line 47, in load self.data, self.stride = _read_heif_image(self._heif_handle, self) File '/usr/local/lib/python3.8/site-packages/pyheif/reader.py', line 402, in _read_heif_image 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
installed libs on my alpine pods:
Any help please !
The text was updated successfully, but these errors were encountered: