ImageMagick adalah alat baris perintah manipulasi gambar sumber terbuka. Ini digunakan untuk membuat, mengedit, mengubah, dan mengonversi .png, .jpg, .gif, dan jenis gambar lainnya. Anda dapat menggunakannya untuk mengubah ukuran dan mengubah gambar, menambahkan hamparan teks, menggambar bentuk, menambahkan efek, melakukan pengeditan warna, dll.
Ini lintas platform, dan tersedia untuk sebagian besar sistem operasi, termasuk Linux, Windows, macOS, dan platform lainnya.
Untuk menginstal ImageMagick di Debian dan Ubuntu, harus mengkompilasi aplikasi dari kode sumber. ImageMagick RPM tersedia untuk distribusi Linux Redhat/CentOS 7.
Disini saya akan menjelaskan langkah-langkah sederhana untuk Install ImageMagick pada distro Debian 10 Linux.
- Langkah 1: Menginstal paket yang diperlukan untuk ImageMagick
- Langkah 2: Mengunduh ImageMagick
- Langkah 3: Mengkompilasi kode sumber ImageMagick
- Langkah 4: Memverifikasi Instalasi ImageMagick
- Copot pemasangan ImageMagick
- Kesimpulan
Langkah 1: Menginstal paket yang diperlukan untuk ImageMagick
Untuk menginstal ImageMagick dari kode sumber, pertama-tama instal kompiler dan alat pengembangan terkait.
Kita harus menginstal paket build-essential dari repo:
$ sudo apt update $ sudo apt-get install build-essential
Sekarang lanjutkan dengan mengunduh kode sumber ImageMagick.
Langkah 2: Mengunduh ImageMagick
Unduh arsip kode sumber terbaru langsung dari situs web resmi ImageMagick menggunakan perintah wget, ketik:
$ wget //www.imagemagick.org/download/ImageMagick.tar.gz
Setelah unduhan selesai, ekstrak isinya, lalu masukkan direktori yang diekstrak dari arsip:
$ tar xvzf ImageMagick.tar.gz $ cd ImageMagick-7.0.10-35/
Selanjutnya, lanjutkan dengan kompilasi kode sumber.
Langkah 3: Mengkompilasi kode sumber ImageMagick
Pertama, konfigurasikan skrip ImageMagick make dengan menjalankan perintah ./configure untuk mengonfigurasi lingkungan kompiler:
$./configure
Ketika skrip configure telah selesai dieksekusi, jalankan perintah make untuk memulai proses kompilasi.
$ make
Setelah kompilasi selesai, instal file biner ImageMagick, lalu konfigurasikan binding run-time linker dinamis:
$ sudo make install $ sudo ldconfig /usr/local/lib
Untuk menemukan lokasi instalasi ImageMagick dengan mengetik:
$ whereis magick
magick: /usr/local/bin/magick
Langkah 4: Memverifikasi Instalasi ImageMagick
Pada akhirnya, verifikasi bahwa ImageMagick 7 telah berhasil diinstal pada sistem Debian atau Ubuntu dengan memeriksa versi binernya.
$ magick -version Version: ImageMagick 7.0.10-35 Q16 x86_64 2020-11-05 //imagemagick.org Copyright: © 1999-2020 ImageMagick Studio LLC License: //imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP[4.5] Delegates [built-in]:
Atau gunakan perintah alternatif:
$ identify -version Version: ImageMagick 7.0.10-35 Q16 x86_64 2020-11-05 //imagemagick.org Copyright: © 1999-2020 ImageMagick Studio LLC License: //imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP[4.5] Delegates [built-in]:
Copot pemasangan ImageMagick
Untuk menghapus magick [dari direktori kode sumber], jalankan:
$ sudo make uninstall
Kesimpulan
Dalam tutorial ini, kami telah menunjukkan cara menginstal ImageMagick 7 dari kode sumber di Linux Debian 10 dan Ubuntu.
Anda dapat menggunakan bagian komentar di bawah untuk mengirim saran dan pertanyaan apa pun yang mungkin Anda miliki terkait artikel ini.
← ServerPilot Docs
Table of Contents
- Imagick: The PHP ImageMagick Extension
- Using Imagick with PDF Files
- Verifying the Installation
- Uninstalling the ImageMagick Extension
- How do I add imagick to PHP?
- How do I add imagick?
- How do I install imagick library?
- What is imagick PHP extension?
In the examples shown, replace "X.Y" with your app's PHP version [for example, "5.4" or "7.0"]. To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.
If your app requires the ImageMagick command line interface rather than the ImageMagick PHP extension, see the article on installing the ImageMagick executables.
ServerPilot cannot provide support for customizations. We always recommend avoiding customizations unless you absolutely need to customize your server. Customizations increase complexity, and complexity often leads to downtime and vulnerabilities.
The ImageMagick extension supports PHP 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, and 7.4.
Imagick: The PHP ImageMagick Extension
The ImageMagick extension, called Imagick when referring to the PHP extension, is a native PHP extension to create and modify images using the ImageMagick API.
To install this extension, run the following commands as your server's root user:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config sudo apt-get -y install libmagickwand-dev sudo peclX.Y-sp install imagick
When prompted with:
Please provide the prefix of Imagemagick installation [autodetect] :
just press Enter; do not type a prefix [that is, allow autodetect].
Once installed, create a configuration file for the extension and restart PHP by running the following commands as root:
sudo bash -c "echo extension=imagick.so > /etc/phpX.Y-sp/conf.d/imagick.ini" sudo service phpX.Y-fpm-sp restart
Using Imagick with PDF Files
ImageMagick was not designed to securely handle untrusted PDF files. Enabling PDF file handling as shown below is dangerous if any malicious PDF files are ever processed.
Additionally, attempting to work around ImageMagick's PDF security issues by using Ghostscript directly is also dangerous as Ghostscript is also vulnerable to exploitation when processing malicious PDF files.
In order to allow ImageMagick to process PDF files, you must SSH into your server as root and edit the following file:
/etc/ImageMagick-6/policy.xml
Locate the line:
Comment out this line by replacing it with the following:
Finally, restart PHP:
sudo service phpX.Y-fpm-sp restart
Verifying the Installation
You can verify the ImageMagick extension is installed with this command:
phpX.Y-sp -i | grep imagick
If ImageMagick is installed correctly, you will see the following:
/etc/phpX.Y-sp/conf.d/imagick.ini, imagick imagick module => enabled imagick module version => 3.4.3RC1 imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator Imagick compiled with ImageMagick version => ImageMagick 6.6.9-7 2016-06-01 Q16 //www.imagemagick.org Imagick using ImageMagick library version => ImageMagick 6.6.9-7 2016-06-01 Q16 //www.imagemagick.org imagick.locale_fix => 0 => 0 imagick.progress_monitor => 0 => 0 imagick.skip_version_check => 0 => 0
Uninstalling the ImageMagick Extension
To uninstall this extension, as root run the commands:
sudo rm /etc/phpX.Y-sp/conf.d/imagick.ini sudo peclX.Y-sp uninstall imagick
Next, restart PHP-FPM with the command:
sudo service phpX.Y-fpm-sp restart
Last updated: February 22, 2020
You already got PHP 7.0 on your Debian Buster somewhere, despite it comes with PHP 7.3. That's most likely from the DEB.SURY.ORG repository, which also has a suitable version of php-imagick
:
$ apt-cache show php-imagick
Package: php-imagick
Version: 3.4.4-4+0~20200302.14+debian10~1.gbp2925ae
. . .
Provides: php5.6-imagick, php7.0-imagick, php7.1-imagick ...
But it also shows you this official Debian 10 Buster version:
Package: php-imagick
Version: 3.4.3-4.1
. . .
Provides: php7.3-imagick
I tested on a Debian 10 Buster with the Sury repository, and the one from Sury was installed by default just by using apt-get install php-imagick
. However, if it didn't, you could choose to install this
version through the php7.0-imagick
it provides:
$ sudo apt-get install php7.0-imagick
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php-imagick' instead of 'php7.0-imagick'
This php-imagick
will be the one from DEB.SURY.ORG.
But next time, please think through all your dependencies before rushing to upgrade the OS.
View Discussion
Improve Article
Save Article
View Discussion
Improve Article
Save Article
The Imagick function is used to create and modify images using the ImageMagick API. The ImageMagick is the software suite to create edit and modify the compose bitmap images. This functions read, write and converts images in many formats including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF.
Requirements: PHP 5.1.3 and ImageMagick 6.2.4 versions required to install ImageMagick.
The installation process of ImageMagick [Imagick] on Ubuntu: There are some steps to install ImageMagick and Imagick PHP extension on Ubuntu 16.04, 18.04 and above versions which are listed below:
- Install Apache Server: If apache server is not installed in your system then first install the apache2 server.
- Make Superuser: Open terminal and use following command to make yourself superuser.
sudo su
- Install Required Packages: Use the following command to Install the required packages of ImageMagick and Imagick PHP extension.
$ sudo apt install php php-common gcc
- Install
ImageMagick extension: Now install the ImageMagick PHP extension by using the following command.
$ sudo apt install imagemagick
- Install Imagick extension: After completion of ImageMagick package, the Imagick PHP extension will install.
$ sudo apt install php-imagick
- Restart Apache Server: Restart the apache server by using the following command.
$ sudo systemctl restart apache2
- Verify the Imagick extension: The Imagick
extension can be verified by using the following command.
$ php -m | grep imagick
How do I add imagick to PHP?
Navigate to Home - Software - Module Installers, then click on the Manage button next to PHP Pecl. In the next screen, select the required PHP version, then click Apply. You can now enter “imagick” in the Install a PHP Pecl field, and click the Install Now button.
How do I add imagick?
Show activity on this post..
Download the binaries on the PECL page [look for the "DLL" links]. alternative listing [more direct access, same files].
Open the archive, copy all the *. dll files to the "php\ext" directory..
Add the extension to your php. ini: Usually you should add extension=php_imagick. ... .
Restart web server..
How do I install imagick library?
To install ImageMagick from the source:.
First download the latest version of the program sources - ImageMagick. ... .
Unzip the package to a folder of choice. ... .
In the folder where you have unzipped ImageMagick run the configuration script: ... .
If no errors were found, you can start the install process..
What is imagick PHP extension?
Imagick is a PHP extension to create and modify images using the ImageMagick library. There is also a version of Imagick available for HHVM. Although the two extensions are mostly compatible in their API, and they both call the ImageMagick library, the two extensions are completely separate code-bases.