-
Notifications
You must be signed in to change notification settings - Fork 21
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
precompiled: HEIC support not working? #175
Comments
@feld is it possible to share the image? Prebuilt binaries does support 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
|
Yeah, it's just a basic test file we use edit: if github mangled this, here's a link from our repo |
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:
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? |
That would be hard. I am using |
@akash-akya thanks for this incredible library. We need hevc support as well. It's a shame about all those licensing restrictions. If you have are put together a nix flake that makes it easy to install a build with hevc support, I'd be happy to pay for the time it takes you to get that up if that is something interesting to you. |
Hey @venkatd, Thanks for using the library. |
Great! I'll send you an email |
Hey @venkatd, sorry for the delayed response. NixOS repo already provides libvips package with x265/HEIC support. So we can just use it. Here's a step-by-step guide to use it:
{
description = "Using Nix libvips with Elixir";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.vips
pkgs.elixir # optional. I am using the Elixir provided by Nix
pkgs.pkg-config
];
};
formatter = pkgs.nixfmt-rfc-style;
}
);
}
Mix.install([{:vix, "~> 0.23", force: true}],
system_env: [
# must be set to PLATFORM_PROVIDED_LIBVIPS, otherwise Vix uses prebuilt libvips
{"VIX_COMPILATION_MODE", "PLATFORM_PROVIDED_LIBVIPS"}
]
)
alias Vix.Vips.{Image, Operation}
{:ok, thumb} = Operation.thumbnail("image.heic", 300)
:ok = Image.write_to_file(thumb, "thumbnail.jpg", Q: 90, strip: true, interlace: true)
$ nix develop This will install required Nix dependencies and create a
$ elixir thumb.exs input.heic Note: You may need to modify the If you want greater control over libvips and its dependencies, you can create a new flake and use that instead of using the default libvips. The custom libvips pkg might look like this {
description = "Flake for building libvips";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
libvips-src = {
url = "github:libvips/libvips/v8.16.0";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
libvips-src,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
libvips = pkgs.stdenv.mkDerivation {
pname = "libvips";
version = "8.16.0";
src = libvips-src;
nativeBuildInputs = with pkgs; [
gobject-introspection
meson
ninja
pkg-config
];
buildInputs =
with pkgs;
[
glib
libxml2
expat
# Optional dependencies
cfitsio
cgif
fftw
imagemagick
giflib
lcms2
libarchive
libde265
libexif
libgsf
libheif
libimagequant
libjpeg
libjxl
libpng
librsvg
libspng
libtiff
libtiff
libwebp
matio
openexr
openjpeg
openslide
pango
poppler
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
ApplicationServices
Foundation
];
# Required by .pc file
propagatedBuildInputs = with pkgs; [
glib
];
mesonFlags = with pkgs.lib; [
(mesonEnable "pdfium" false)
(mesonEnable "nifti" false)
(mesonBool "deprecated" false)
(mesonBool "gtk_doc" false)
];
meta = with pkgs.lib; {
homepage = "https://www.libvips.org/";
description = "Image processing system";
license = licenses.lgpl2Plus;
maintainers = with maintainers; [
akash-akya
];
pkgConfigModules = [
"vips"
"vips-cpp"
];
platforms = platforms.unix;
mainProgram = "vips";
};
};
in
{
packages.default = libvips;
# Expose as an overlay
overlays.default = final: prev: {
libvips = libvips;
};
# Development shell
devShells.default = pkgs.mkShell {
buildInputs = [
self.packages.${system}.default
pkgs.pkg-config
];
};
formatter = pkgs.nixfmt-rfc-style;
}
);
} I can assist you with further details if you want. |
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 😭
The text was updated successfully, but these errors were encountered: