Skip to content

LibraryLink paclet for exposing libheif functionality, enabling decoding and encoding HEIF and AVIF image files

License

Notifications You must be signed in to change notification settings

WolframResearch/HEIFTools

Repository files navigation

HEIFTools for Wolfram Language

HEIFTools logo

HEIFTools is a package that adds HEIF import and export capabilities to the Wolfram Language. It is a LibraryLink paclet that connects to libheif.

Installing and running

HEIFTools can be installed in Wolfram Language 15.0 or newer.

The paclet will be downloaded and installed automatically when it is necessary for Import or Export.

To manually install a specific release, download it from the Github repo's releases page and run the following command in the Wolfram Language:

PacletInstall["/full/path/to/HEIFTools.paclet"]

This will permanently install the HEIFTools paclet. The Wolfram Language will always use the latest installed version of HEIFTools. Installed versions can be enumerated using the command:

PacletFind["HEIFTools"]

And all versions can be uninstalled using the command:

PacletUninstall["HEIFTools"]

Once installed, load the package and call functions:

In[1]:= Needs["HEIFTools`"]

In[2]:= (* Check the library version: *)
	HEIFTools`HEIFGet["Version"]

Out[2]= "1.20.2"

In[3]:= (* Get a sample HEIF image: *)
	f = FindFile@"ExampleData/sample.heic";

In[4]:= (* Read its properties: *)
	WithCleanup[
		handle = HEIFTools`HEIFOpenFile[f]
		,
		HEIFTools`HEIFGet[handle]["Properties"]
		,
		HEIFTools`HEIFClose[handle]
	]

Out[4]= <|"ImageSize" -> {480, 320}, "Channels" -> {3}|>

Check the demo notebook Examples/HEIFTools.nb for more examples and documentation.

Building from sources

To build HEIFTools from sources, the following must be installed:

  • CMake 3.15+
  • git
  • Wolfram App 15.0+ with wolframscript
  • libheif 1.20.2+ (preferably installed from vcpkg)
  • a C++ compiler supporting C++20 (e.g gcc 14)

Proceed as follows:

  1. Clone this project from GitHub, including submodules
git clone https://github.com/WolframResearch/HEIFTools.git --recurse-submodules
  1. Configure the CMake project in a build directory of your choice:
cd <root directory of HEIFTools>

mkdir build/

cd build

cmake -DWolframLanguage_INSTALL_DIR=<full path to Wolfram App> \
      -Dlibheif_DIR=<full path to libheif installation> \
      -DCMAKE_BUILD_TYPE=Release
      ..

If you are not sure where the Wolfram software is installed on your system, check the value of $InstallationDirectory symbol. 3. Build and install the .paclet file. Evaluate the following command in the build directory:

cmake --build . --target install paclet --config Release

HEIFTools paclet is now installed and ready to use.

More...

See the following files for more information:

Contributors

  • Rafał Chojna (rafalc)
  • Narek Aydinyan (nareka)
  • Mikayel Egibyan (mikayele)

About

LibraryLink paclet for exposing libheif functionality, enabling decoding and encoding HEIF and AVIF image files

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published