Linux

How to Enable JP2 (JPEG 2000) Support in ImageMagick on DirectAdmin

By default, ImageMagick installed via DirectAdmin CustomBuild does not include JP2 (JPEG 2000) support.
This feature requires additional libraries (openjpeg2 or jasper) and custom configuration flags.

Follow the steps below to permanently enable JPEG2000 on your DirectAdmin server. 

Step 1: Install JP2 Libraries

Run the following command to install JPEG2000 dependencies:

sudo dnf install epel-release -y
sudo dnf update -y
sudo dnf install openjpeg2 openjpeg2-devel -y
  • openjpeg2 → modern and recommended JPEG 2000 implementation

  • jasper → older, legacy library for compatibility

Step 2: Create a Custom Configuration File for ImageMagick

DirectAdmin stores ImageMagick build options inside the CustomBuild system.
To prevent your changes from being overwritten by future updates, create a custom config file:

mkdir -p /usr/local/directadmin/custombuild/custom/configure/imagemagick
nano /usr/local/directadmin/custombuild/custom/configure/imagemagick/configure.php

Add the following lines:

--with-openjp2 \
--with-jpeg \
--with-png \
--with-tiff \
--with-webp \
--with-xml \
--enable-shared \
--disable-static

Optional: add --with-jasper if you want to include Jasper as well.
The --with-openjp2 flag is sufficient for most systems.

Save and exit (Ctrl + O, Enter, Ctrl + X).

Step 3: Rebuild ImageMagick via CustomBuild

Rebuild ImageMagick with the new configuration:

cd /usr/local/directadmin/custombuild
./build update
./build imagemagick

If you are using PHP’s Imagick extension, rebuild it too:

./build imagick

For multiple PHP versions:

./build imagick php80
./build imagick php81

Step 4: Verify JP2 Support

Check if JP2 is now available in ImageMagick:

magick -list format | grep JP2

You should see:

JP2* rw+  JPEG-2000 File Format (2.3.1)

Success — your server now supports JPEG2000.

Step 5: Verify in PHP

To confirm the Imagick PHP extension also supports JP2:

php -r 'print_r(Imagick::queryFormats());' | grep JP2

If “JP2” appears → PHP Imagick successfully recognizes the delegate.

Thanks for visit my website