TrueNAS/FreeBSD NextCloud jail enable HEIC support

Next Cloud uses ImageMagick to create, display and manipulate images in the web frontend. Unfortunately the NextCloud Plugin has been created without ImageMagick support for HEIC. Therefore we need to make our own ImageMagick package with enabled HEIC support and replace it by the original one. This can be done using ports:

The FreeBSD Ports and Packages Collection offers a simple way for users and administrators to install applications. Instead to the pkg approach, with Ports no precompiled and configured packages are downloaded and installed on your FreeBSD system. You download the source code and create your own package based on your needs.

To start, login to the console of your NextCloud jail:

Step 1: Install required PKG packages:

When I tried to make my own package in my jail I got several errors because required dependencies needed by make where not installed or could not successfully compiled. Instead of searching for the reason I decided to go the easy way and installed some dependencies, using PKG:

pkg install dialog4ports
pkg install gobject-introspection
pkg install gdk-pixbuf2
pkg install libheif

Step 2: Download ports and build your own ImageMagick package:

Fetch a snapshot of Ports:

portsnap fetch

Extract the snap

portsnap extract

Go into the ImageMagick ports source folder:

cd /usr/ports/graphics/ImageMagick7-nox11

Configure the new package:

make config

Enable HEIF (this is the same as HEIC) in the window (and other image formats you want that ImageMagick should support):

Press OK/Enter to confirm.

Make&build the package:

make -DBATCH -DALLOW_UNSUPPORTED_SYSTEM

I need to add the -DALLOW_UNSUPPORTED_SYSTEM flag because I have an older jail version which is no longer natively supported by Ports. I you have a newer jail version you can skip this flag. Now the system ist building/compiling the ImageMagick package. Dependent on your system resources, this can take a while.

If make could successfully finished (like the above image), enter the following command to replace the current ImageMagick Version by our compiled one:

make deinstall reinstall

Now lock the ImageMagick package:

pkg lock ImageMagick7-nox11

Confirm the lock by pressing y

Autoremove all leftovers of the original ImageMagick package:

pkg autoremove

Again confirm with y

Check if HEIC/HEIF is now enabled by using the following command:

convert -list format | grep HEIC

You should get the following return:

Congratulations, you have successfully compiled your own ImageMagick package with enabled HEIC/HEIF. After a short time you should be able to see thumbnails of HEIC/HEIF images in your NextCloud instance.

Optional: Release the lock:

pkg unlock ImageMagick7-nox11

Warning: if you update your jail with an unlocked ImageMagick it is possible that the changes will be overwritten.

This tutorial bases on the following discussion in the TrueNAS Forum:

Print Friendly, PDF & Email

2 comments

  1. Hello! I found your guide after many days of trying to get this working. I followed it and everything when as you outlined – but I still can’t get the previews. I get an “Error loading filename.heic” when looking at pictures and no previews. Would you be able to offer some suggestions on what I might have missed?

Leave a Reply

Your email address will not be published. Required fields are marked *