imageMagick installation problems - imagemagick

I have installed imageMagick but i get a warning loaded PHP Startup. How can i solve this?
[root#vps06 /]# identify -version
Version: ImageMagick 6.8.1-10 2013-07-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jng jp2 jpeg lcms png ps tiff x zli
[root#vps06 /]# php -m | grep imagick
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - libfftw3.so.3: cannot open shared object file: No such file or directory in Unknown on line 0

You'll need to install the imagick module for PHP. The easiest way would be with the PECL command.
sudo pecl install imagick
You can also manually install this package if you need more control of your local build
curl -O http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxvf imagick-3.1.0RC2.tgz && cd imagick-3.1.0RC2.tgz
phpize
./configure # Add custom build options here
make
sudo make install

Related

ImageMagick cannot get file from HTTPS from inside a Docker container

I'm trying to use ImageMagick 7 in a Docker container. However it doesn't install any delegates, though I added libpng-dev. When I try to get an image inside the container from https with this command:
magick https://www.nasa.gov/sites/default/files/thumbnails/image/moon_mosaic.png ./test.png
I get this message:
magick: no decode delegate for this image format `DAT' # error/constitute.c/ReadImage/738.
This doesn't make sense, since it is a PNG image and not a DAT file.
Here my Dockerfile:
FROM debian:bullseye-slim
ARG IM_VERSION="7.1.0-37"
ARG IM_BUILD_FLAGS="--enable-shared --disable-static --without-modules --enable-delegate-build --disable-docs --with-heic=yes"
WORKDIR /app
RUN apt-get update && apt-get install -y wget && \
apt-get install -y build-essential curl libpng-dev && \
wget https://github.com/ImageMagick/ImageMagick/archive/refs/tags/${IM_VERSION}.tar.gz && \
tar xzf ${IM_VERSION}.tar.gz && \
rm ${IM_VERSION}.tar.gz && \
apt-get clean && \
apt-get autoremove
WORKDIR /app/ImageMagick-${IM_VERSION}
RUN sh ./configure ${IM_BUILD_FLAGS} && make -j && make install && ldconfig /usr/local/lib/
Here the output from the configure part of building ImageMagick:
configure:
==============================================================================
ImageMagick 7.1.0-37 is configured as follows. Please verify that this
configuration matches your expectations.
Host system type: x86_64-pc-linux-gnu
Build system type: x86_64-pc-linux-gnu
Option Value
------------------------------------------------------------------------------
Shared libraries --enable-shared=yes yes
Static libraries --enable-static=no no
Build utilities --with-utilities=yes yes
Module support --with-modules=no no
GNU ld --with-gnu-ld=yes yes
Quantum depth --with-quantum-depth=16 16
High Dynamic Range Imagery
--enable-hdri=yes yes
Install documentation: no
Memory allocation library:
JEMalloc --with-jemalloc=no no
TCMalloc --with-tcmalloc=no no
UMem --with-umem=no no
Delegate library configuration:
BZLIB --with-bzlib=yes no
Autotrace --with-autotrace=no no
DJVU --with-djvu=yes no
DPS --with-dps=yes no
FFTW --with-fftw=no no
FLIF --with-flif=no no
FlashPIX --with-fpx=yes no
FontConfig --with-fontconfig=yes no
FreeType --with-freetype=yes no
Ghostscript lib --with-gslib=no no
Graphviz --with-gvc=yes no
HEIC --with-heic=yes no
JBIG --with-jbig=yes no
JPEG v1 --with-jpeg=yes no
JPEG XL --with-jxl=no no
LCMS --with-lcms=yes no
LQR --with-lqr=yes no
LTDL --with-ltdl=no no
LZMA --with-lzma=yes no
Magick++ --with-magick-plus-plus=yes yes
OpenEXR --with-openexr=yes no
OpenJP2 --with-openjp2=yes no
PANGO --with-pango=yes no
PERL --with-perl=no no
PNG --with-png=yes no
RAQM --with-raqm=yes no
RAW --with-raw=yes no
RSVG --with-rsvg=no no
TIFF --with-tiff=yes no
WEBP --with-webp=yes no
WMF --with-wmf=no no
X11 --with-x= no
XML --with-xml=yes no
ZIP --with-zip=yes no
ZLIB --with-zlib=yes no
ZSTD --with-zstd=yes no
Delegate program configuration:
GhostPCL None pcl6 (unknown)
GhostXPS None gxps (unknown)
Ghostscript None gs (unknown)
Font configuration:
Apple fonts --with-apple-font-dir=default
Dejavu fonts --with-dejavu-font-dir=default none
Ghostscript fonts --with-gs-font-dir=default none
URW-base35 fonts --with-urw-base35-font-dir=default none
Windows fonts --with-windows-font-dir=default none
X11 configuration:
X_CFLAGS =
X_PRE_LIBS =
X_LIBS =
X_EXTRA_LIBS =
Options used to compile and link:
PREFIX = /usr/local
EXEC-PREFIX = /usr/local
VERSION = 7.1.0-37
CC = gcc
CFLAGS = -fopenmp -Wall -g -O2 -mtune=ivybridge -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CPPFLAGS = -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PCFLAGS =
DEFS = -DHAVE_CONFIG_H
LDFLAGS =
LIBS = -lm -lpthread
CXX = g++
CXXFLAGS = -pthread
FEATURES = DPC HDRI Cipher OpenMP
DELEGATES =
==============================================================================
All delegates seem to be not active.
EDIT: I checked the output again. It seems like it doesn't find libpng
-------------------------------------------------------------
checking for libpng >= 1.0.0... no
-------------------------------------------------------------
I checked the installed version and it is 1.6.37-3
When I use ImageMagick outside of the Docker container it works without problems. I'm not sure what the problem is and why it doesn't configure the delegates. Sadly I can't install ImageMagick 7 with apt.
Try adding pkg-config, and possibly also autoconf, to your prerequisite package list. ImageMagick is considerably better at finding and configuring stuff with those helpers, especially the PNG delegate:
RUN apt-get update && apt-get install -y wget && \
apt-get install -y autoconf pkg-config ...
Actually, the Alpine docker image is brilliant for ImageMagick. It is very current, very small, and includes loads of delegates:
docker run --rm -it -v "$(pwd)":/work -w /work alpine:latest
/work # apk add --no-cache imagemagick
...
... output, output, output
... and then around 4 seconds later
...
/work # magick identify -version
Version: ImageMagick 7.1.0-50 beta Q16-HDRI x86_64 20489 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib cairo fontconfig freetype gslib heic jng jpeg jxl lcms ltdl lzma png ps rsvg tiff webp x xml zlib
Compiler: gcc (11.2)

Mediawiki with Docker Imagemagick

i want to use Imagemagick that runs inside Docker. I created a convert.sh file that runs my Imagemagick with arguments:
convert.sh :
#!/bin/bash
IMAGE=imagemagick
ARGS=$#
exec docker run --rm -i --user="$(id -u):$(id -g)" \
-v "$PWD":/workdir \
$IMAGE /bin/bash -c \
"/usr/bin/convert $ARGS"
Command:
./convert.sh --version
Output:
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org Copyright: © 1999-2017 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules OpenMP Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
So my imagemagick is accessible.
Inside LocalSetting.php i added:
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/path/to/my/convert.sh";
Sadly this isn't working. I get the error
Error creating the preview image: sh: 1: convert: not found
How can i fix that?

How can I download all the Latex Packages to my ubuntu system?

I installed LaTeX python package on my system and able to compile small latex files. How to install all the existing packages from CTAN to my computer automatically?
How other online Latex editors are able compile any kind of latex file? How are they getting the required packages ?
Any suggestions please...
Installed the followig commands on ubuntu local machine
sudo apt-get install texlive texstudio # for latex
sudo apt-get install texlive-full # for full texlive packages
sudo apt-get install xzdec # for tlmgr
Also for online installation you can do this
wget -O http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
chmod u+x /tmp/install-tl-unx.tar.gz
cd /tmp && tar zxvf install-tl-unx.tar.gz
./install-tl
This will install latex packages on your server

ImageMagick convert jpx and jpf to jpg (Ubuntu 16)

I want to convert images with format jpx and jpf to jpg on Ubuntu 16.
After some research i found out that it is require jp2 delegate. Right now when i executed command
convert -list configure | grep DELEGATES
i got this
bzlib djvu mpeg fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pango png ps rsvg tiff wmf x xml zlib
How can i install jp2 delegate on my system? Or if any other way to convert jpf and jpx to jpg, Please suggest me.
Updated Answer
I am trying to get this working more simply, but only have a limited understanding of Ubuntu Package Managers. Here is my current, simplest, working solution.
Step 1 - Install OpenJPEG2000 and all the build tools
Install v2.1 of OpenJPEG2000 Ubuntu 16 with:
sudo apt-get remove --purge libopenjp2-7 libopenjp2-7-dev
sudo apt-get install libopenjp2-7 libopenjp2-7-dev
sudo apt-get install build-essential pkg-config
Step 2 - set PKG_CONFIG_PATH
That is good and it is the one ImageMagick needs, however, it seems maybe to be in a different place from where ImageMagick expects it. It is not in /usr/lib nor /usr/local/lib, but rather it is here:
/usr/lib/x86_64-linux-gnu/libopenjp2.so.7
/usr/lib/x86_64-linux-gnu/libopenjp2.so
/usr/lib/x86_64-linux-gnu/pkgconfig/libopenjp3d.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libopenjp2.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libopenjpip.pc
/usr/lib/x86_64-linux-gnu/openjpeg-2.1
/usr/lib/x86_64-linux-gnu/libopenjp2.so.2.1.0
So, set your PKG_CONFIG_PATH
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/lib/x86_64-linux-gnu/pkgconfig
Step 3 - Install and build ImageMagick from source
cd
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar -xzvf Im*gz
cd Image*[0-9]
./configure
make clean
make -j 8
sudo make install
Original Answer - which works but is cumbersome
Well, this was painful to work out but it works! Ubuntu 16 LTS
First, remove any dead versions of ImageMagick installed via apt-get.
sudo apt-get remove --purge imagemagick
Then, make sure you have all the packages you need to build software with:
sudo apt-get install build-essential cmake pkg-config
Next, install JPEG200 library, version 2.1 or better!!!!
cd
wget https://github.com/uclouvain/openjpeg/archive/v2.1.2.tar.gz
gunzip open*gz
tar -xvf open*tar
cd open*2
mkdir build # Out of source builds are preferred
cd build
cmake --prefix=/usr ..
make clean
make -j 8
sudo make install
Now, install ImageMagick:
cd
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
gunzip Image*gz
tar -xvf *agick*tar
cd ImageMagick-7.0.4-6/
./configure --prefix=/usr
make clean
make -j 8
sudo make install
Now test:
identify -list configure | grep DEL
DELEGATES mpeg jpeg openjp2 ps

Failed to run Apache Singa after installation

Followed the instruction and installed Apache Singa v1.0.0 from the wheel successfully, but failed to run it below,
(singa) $ pip list | grep singa
singa (1.0.0)
(singa) $ python
> import singa
> ImportError: No module named '_singa_wrap'
(singa) $ find -name "*singa_wrap*"
singa_wrap.py
singa_wrap.pyc
_singa_wrap.so
Seemed something suspicious with Swig module extension. Any suggestions?
#EDIT
Verified that protobuf 2.6.1 already installed globally below,
(singa) $ python -c "from singa import _singa_wrap"
undefined symbol: _ZNK6google8protobuf7Message11GetTypeNameEv
$ ldd _singa_wrap.so
libprotobuf.so.9 => /usr/lib/x86_64-linux-gnu/libprotobuf.so.9
$ dpkg -S libprotobuf.so.9
libprotobuf9v5
$ apt-cache policy libprotobuf9v5
Installed: 2.6.1-1.3
#Solution
Singa starts dancing now after protobuf 2.6.1 being successfully installed locally on Ubuntu 16.04 below,
$ sudo apt-get install python-pip # gcc-5 required thus installed
$ sudo apt-get install gcc-4.8
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
$ sudo update-alternatives --config gcc # to choose gcc-4.8
The rest then follows the answer #Wei below. Thanks again.
I think you can try the approaches in the first FAQ http://singa.apache.org/en/docs/installation.html#faq
In addition, you can check the dependent libs of _singa_wrap.so (go to /Python2.7/site-packages/singa/, and ldd _singa_wrap.so. If any library (e.g. cudnn or protobuf) is not found, then try to install it or export the library path.
There is a ticket for your issue https://issues.apache.org/jira/browse/SINGA-255.
Will update you once it is done.
Thanks.
UPDATE:
It seems your error is related to protobuf (could be caused by multiple versions of protobuf on your computer). Here is the solution,
Download protobuf (protobuf-2.6.1.tar.gz on github) and decompress the tar file
Install protobuf into /home//local/ by
./configure --prefix=/home/<yourname>/local
make && make install
echo "export LD_LIBRARY_PATH=/home/<yourname>/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc
pip uninstall singa
pip install <path to the wheel file>

Resources