Welcome to our blog post on how to enable HEIC / HEIF on your RunCloud server. HEIC and HEIF are image formats that provide higher quality and smaller file sizes compared to other popular formats such as JPEG and PNG. This can be incredibly beneficial for those who want to save space on their server and improve the performance of their website.
In this post, we will provide step-by-step instructions on how to enable HEIC / HEIF on your RunCloud server. We will also discuss the benefits of using these formats and how they can help improve the overall performance of your website.
Introduction
First, let's talk about what HEIC and HEIF are and why they are important. HEIC (High-Efficiency Image Format) and HEIF (High-Efficiency File Format) are both container formats that can be used to store and share digital images and videos. They are developed by the Moving Picture Experts Group (MPEG) and are the successor to the popular JPEG format.
Unlike JPEG, which uses lossy compression, HEIC and HEIF use lossless compression to reduce file sizes without sacrificing image quality. This means that the images and videos stored in these formats will be of higher quality and will take up less space on your server.
How to enable HEIC / HEIF in RunCloud servers?
Now that you know what HEIC and HEIF are, let's move on to the steps on how to enable them on your RunCloud server.
Step 1
- Follow the steps below to install the latest version of ImageMagick. Part of this will be to build and install the latest version of libde265 and libheif which are needed for compiling ImageMagick with HEIC option.
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
apt-get update
apt-get install build-essential autoconf libtool git-core
apt-get build-dep imagemagick libmagickcore-dev libde265 libheif
cd /usr/src/
git clone https://github.com/strukturag/libde265.git
git clone https://github.com/strukturag/libheif.git
cd libde265/
./autogen.sh
./configure
make -j$(nproc)
make install
cd /usr/src/libheif/
./autogen.sh
./configure
make -j$(nproc)
make install
cd /usr/src/
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xf ImageMagick.tar.gz
cd ImageMagick-7*
./configure --with-heic=yes
make -j$(nproc)
make install
ldconfig
As you may noticed, there isn't much I can explain regarding these commands as they are straightforward.
Step 2
Now, we need to install the ImageMagic php extension. However, the normal "apt install" command will not compile the heic format so we need to manually compile as done here.
apt-get install autoconf libpcre3-dev
MODULE_NAME="imagick"
MODULE_VERSION="3.7.0"
cd ~
wget https://pecl.php.net/get/$MODULE_NAME-$MODULE_VERSION.tgz
tar -zxvf $MODULE_NAME-$MODULE_VERSION.tgz
cd $MODULE_NAME-$MODULE_VERSION
#If you are installing to php81 then follow below commands(you can replace 81 with your required version)
make clean
/RunCloud/Packages/php81rc/bin/phpize --clean
/RunCloud/Packages/php81rc/bin/phpize
./configure --with-php-config=/RunCloud/Packages/php81rc/bin/php-config --with-libdir=lib64 CFLAGS='-O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fsigned-char -fno-strict-aliasing'
make install
echo "extension=$MODULE_NAME.so" > /etc/php81rc/conf.d/$MODULE_NAME.ini
systemctl restart php81rc-fpm
Please note, you can change the Imagick version according to the latest release and your requirements. Also, you can change the PHP version from PHP81rc to the specific one required on your project. For this example, we have used PHP81rc, and kindly substitute required version to run above command. Once the commands run without any issues, you can verify as below
/RunCloud/Packages/php81rc/bin/php -r 'phpinfo();' | grep HEIC
The expected result looks like this
Source : https://eplt.medium.com/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1
Conclusion
In conclusion, enabling HEIC / HEIF in RunCloud servers is a simple process that can greatly improve the quality and efficiency of image management on your server. By following the steps outlined in this blog, you can easily enable this feature and take advantage of its many benefits. Whether you are a professional photographer or just looking to improve your website's performance, implementing HEIC / HEIF in RunCloud is a smart move.
I hope this blog was helpful to your requirements and please let us know if you require any help.
Comments
Post a Comment