How to install ImageMagick for PHP 7.3?

I have Ubuntu 14.04 LTS with PHP 7.3 and now I am trying to install ImageMagick. I installed it correctly but I can't install a PHP extension:

sudo pecl install imagick
downloading imagick-3.4.4.tgz ...
Starting to download imagick-3.4.4.tgz (253,434 bytes)
.....................................................done: 253,434 bytes
19 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Please provide the prefix of ImageMagick installation (autodetect) : 
building in /tmp/pear/temp/pear-build-rootjsyRqQ/imagick-3.4.4
running: /tmp/pear/temp/imagick/configure --with-php-config=/usr/bin/php-config --with-imagick
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable the imagick extension... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking ImageMagick MagickWand API configuration program... checking Testing /usr/local/bin/MagickWand-config... Doesn't exist
checking Testing /usr/bin/MagickWand-config... Doesn't exist
checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist
checking Testing /opt/bin/MagickWand-config... Doesn't exist
checking Testing /opt/local/bin/MagickWand-config... Doesn't exist
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
ERROR: `/tmp/pear/temp/imagick/configure --with-php-config=/usr/bin/php-config --with-imagick' failed

But I can't install MagickWand either:

sudo apt-get install pkg-config libmagickwand-dev -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
pkg-config is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libmagickwand-dev : Depends: libmagickcore-dev (= 8:6.7.7.10-6ubuntu3.13) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Escape individual quotes and the dollar sign in for ImageMagick in PHP

I have a command to convert imagemagick using subtitles like this:

convert -size 100x100 -caption: "& # 39 ;. $ mystring. & # 39;" 

I have two cases where I have problems passing the string to the conversion command:

The first has to do with dollar signs:

$ mystring = & # 39; $ 24.95 IS THE PRICE & # 39;

This would appear as: 4.95 IS THE PRICE after ImageMagick processed it.

Therefore, I used

quotemeta ($ mystring);

What worked well, but then I had this other problem in which there was only one appointment at the beginning of the chain:

$ mystring = & # 39; "The man went to the park and & # 39 ;;

This completely broke the script and ImageMagick gave an error when looking for another appointment to go with the first one.

I guess I need to know how to deal with all the different possible text combos that might appear and break this code and how to escape from them? What is the standard solution?

Scan: Imagemagick removes dust from scanning based on a dust scan

Dust removal using a dust mask can be done with G & # 39; MIC with the "Inpaint" [Multi-Scale]"filter.The easiest way to use G & # 39; MIC is as a complement to GIMP, Krita or Paint.NET.However, it is available as a command-line utility.

  1. Convert the dust image into a bitmap with pure pixels in red and white (or transparent). (G & # 39; MIC uses pure red as the default mask color).

  2. Use ImageMagick to superimpose the dust map over the original image.

  3. Call G & # 39; MIC with the "Paint [Multi-Scale]"filter. (You'll have to look for the command).

  4. Repeat with each image.

imagemagick – GraphicsMagick does not centralize the text

For example, I give this command

In the event of a change in the quality of the food, it should be taken into account that most of the vegetables used in the cultivation of spinach, which is not really very different from other vegetables. -thanks center image.png

and he returns that image
insert the description of the image here

But when I define the -The gravity as centerI hope it stays that way
insert the description of the image here

How can I do that ?

How to extract the depth map of the .heif image created with the iPhone X using imagemagick

I created an image with my own iPhone application. The image is in .heif format and contains the depth map. (I know because the Photos app recognizes it)
Now I downloaded and installed imagemagick.
and executed the following command:

magick identify -verbose orginal.HEIC

This shows me only three channels (Channel 0, Channel 1, Channel 2). I guess these are the rgb colors of the image.

How can I access the depth data of this image?