Open feld opened 1 week ago
@feld is it possible to share the image? Prebuilt binaries does support AVIF
images in HEIF container I think. If the image is of HEVC
compression then it wont work.
Main reason why it is not bundled with the prebuilt binaries (and with platform packages) is that patent licensing around HEVC/x265 seems to be messy.
You can check the compression by
{:ok, img} = Vix.Vips.Image.new_from_file(path)
Vix.Vips.Image.header_value(img, "heif-compression")
Yeah, it's just a basic test file we use
edit: if github mangled this, here's a link from our repo
iex(1)> {:ok, img} = Vix.Vips.Image.new_from_file("test/fixtures/image.heic")
{:ok, %Vix.Vips.Image{ref: #Reference<0.267671389.4215406613.43045>}}
iex(2)> Vix.Vips.Image.header_value(img, "heif-compression")
{:ok, "hevc"}
you're right about it being HEVC... now the question is, what does Apple normally use? Time to find a sample
The files I'm finding from iMessages from friends which are HEIC format also report as HEVC...
I see in the FreeBSD project we're shipping libheif with HEVC enabled. In 2020 we stopped restricting things like LAME encoder with this note:
Patents are a complicated topic, and their regulation varies depending on
jurisdiction. Patents are not necessarily related to the license and so
should not be connected to the license framework.
As a project we will officially remove all patent limitations within the
ports tree and leave it to the user or consumer to deal with their local
legislation to determine if they can use the software without legal
restrictions.
Approved by: core
I don't know what to say other than I hope you reconsider and can ship full HEIC/HEIF support as it would make working with this format a lot easier.
I was just thinking about this again and I think a reasonable solution may be to make it possible to self-host the Pre-compiled NIF, perhaps by setting an ENV that is obeyed at build time?
Perhaps I can make a nix flake with dependencies. User can use that to install libvips and then configure vix to use platform provided libvips. Then again, I might not be actively maintaining it, it will be like a path to install libvips. Ideally the nix flake should work with both Macos & Linux. Does that help?
possible to self-host the Pre-compiled NIF
That would be hard. I am using cc_precompiler
to handle NIF pre-compilation and it heavily depends on the current package. We basically have to rewrite all that logic to support this type of usecase.
I'm seeing this on MacOS and Linux with 0.31.1
ok, look like support should be there.
Fails?
On FreeBSD when I am forced to compile against the system provided vips library:
So, it worked here on FreeBSD.
Annoyingly on MacOS (homebrew) and Debian, libvips does not come linked against libheif so that adds a big hurdle to working around this 😭