Opencl in ImageMagick - imagemagick

I installed ImageMagick using the instructions as below
export C_INCLUDE_PATH=/usr/local/cuda/include
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
./configure --prefix=/usr --enable-shared --enable-openmp --enable-opencl --without-dps --without-djvu --without-fftw --without-fpx --without-gslib --without-gvc
make
sudo make install
While checking the imageMagick installation using
identify --version
It is showing as,
Version: ImageMagick 7.0.0-0 Q16 x86_64 2016-04-06
http://www.imagemagick.org Copyright: Copyright (C) 1999-2016
ImageMagick Studio LLC License:
http://www.imagemagick.org/script/license.php Features: Cipher DPC
HDRI OpenCL OpenMP Delegates (built-in): bzlib fontconfig freetype
jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff wmf x xml zlib
When I check the device benchmark file as this :
$ cat ~/.cache/ImageMagick/ImagemagickOpenCLDeviceProfile
it shows
<version>ImageMagick Device Selection v0.9</version>
<device><type></type><name>Quadro M6000</name><driver>352.79</driver><max cu>24</max cu><max clock>1114</max clock><score>0.0960</score></device>
<device><type></type><score>1.1890</score></device>
But when i run the command
time convert /home/downloads/lan.jpg -convolve '-1, -1, -1, -1, 9, -1, -1, -1, -1' /home/downloads/convolve.png
I got the output as
real 0m1.077s user 0m3.072s sys 0m0.032s
In OpenMP i got the output as
real 0m0.946s user 0m3.096s sys 0m0.036s
When i worked with the convert binary file inside the package,
./convert /home/zlabs/lan.jpg -convolve '-1, -1, -1, -1, 9, -1, -1, -1, -1' /home/zlabs/convolve.png
i got
real 0m0.904s user 0m1.824s sys 0m0.024s
Actually the binary file is giving actual performance of opencl. How is it possible? What is happening actually? Is Opencl working or not?

Related

Why does ImageMagick fail with "no decode delegate for this image format `PNG'" even when the png delegate is installed?

I'm working on openSUSE Tumbleweed.
I have ImageMagick installed.
$ convert --version
Version: ImageMagick 7.1.0-52 Q16-HDRI x86_64 20549 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5)
Delegates (built-in): bzlib djvu fontconfig freetype gslib jng jpeg lcms ltdl lzma png ps raw tiff x xml zlib
Compiler: gcc (12.2)
Notice that the PNG delegate is installed, at least according to --version.
Despite this, converting fails.
$ convert covalent_platform.svg covalent_platform.png
convert: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/776.
convert: no images defined `covalent_platform.png' # error/convert.c/ConvertImageCommand/3342.
Even identifying a non-PNG file fails, with the same PNG delegate problem.
$ identify covalent_platform.svg
identify: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/776.
Any ideas for what might be wrong here?
I reinstalled libpng-devel and reinstalled IM, but the problem remains.
I figured out the problem, thanks to #fmw42 pointing out that if magick -list format has no output then the installation is bad.
I had installed IM from https://imagemagick.org/script/download.php
These downloads are not compatible with openSUSE.
After uninstalling and reinstalling IM from https://software.opensuse.org/package/ImageMagick, everything works as expected.

How to configure imagick to work with gpu support?

Im usinf the following configuration on amazon AWS p3.2xlarge with 3D controller: NVIDIA Corporation GV100GL [Tesla V100 SXM2] (rev a1)
Centos 7
PHP7.2
Im trying to force Imagick to work with gpu memory instead of CPU
I have found the following article but im not sure how to implement it
https://www.imagemagick.org/script/opencl.php
can anyone assist ?
convert -version output
Version: ImageMagick 7.0.8-14 Q16 x86_64 2018-10-25 https://imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib

Check for ImageMagick current version based on that uninstall or Install

We are going for penetration testing and for that reason I need to upgrade ImageMagick on our server to 7.0.2-2 because previous version 6.7.x.x (which we currently run) has some high vulnerabilities and to get rid of them we plan to update this.
I want to mange it through ansible and to do a separate installation I have a script but this script doesn't check if there is any previously installed version. It would be great if some can help me in writing a script which first checks for any previous version if there is one uninstalls it and then do new installation of upgraded version.
Many thanks in advance!
You can obtain the version by parsing it out of the first line of output from
identify --version
e.g., on a nearly up-to-date host:
$ identify --version
Version: ImageMagick 7.0.1-1 Q16 x86_64 2016-06-24
http://www.imagemagick.org Copyright: Copyright (C) 1999-2016
ImageMagick Studio LLC License:
http://www.imagemagick.org/script/license.php Features: Cipher DPC
HDRI Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig
jng jpeg lcms lqr lzma openexr png tiff wmf x xml zlib
or on a not-so-up-to-date host:
$ identify --version
Version: ImageMagick 6.6.9-6 2011-04-28 Q16
http://www.imagemagick.org Copyright: Copyright (C) 1999-2011
ImageMagick Studio LLC Features:
Use "sed" or your favorite editor to extract the version string:
identify --version|sed "-e s/Version: ImageMagick //" -e "s/ .*//"|head -1

Imagemagick 6.9.1-7 won't convert psd to any format (Yosemite)

When I run this:
/usr/local/bin/convert ~/desktop/myImage.psd ~/desktop/myImage.jpg
I get this error:
convert: no images defined `/Users/User/desktop/myImage.jpg' # error/convert.c/ConvertImageCommand/3230.
Here's my convert -version:
Version: ImageMagick 6.9.1-7 Q16 x86_64 2015-07-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
I've tried at least 4 different psd files
I am one on the developers of ImageMagick and this version contains a bug in the PSD reader. We are aware of this bug and it will be fixed in 6.9.1-8.
Upgrade to 6.9.1-8 to address the issue.

lcms error using ImageMagick compare on JPEGs with colour profile

When running compare
compare -metric MSE some-image-1.jpg some-image-2.jpg /dev/null
1) When images are identical (OK)
0 (0)
This is what I would expect to see.
2) When images differ (OK)
Error: Command failed: 13.1266 (0.000200299)
I can get the data that I want, but I'm not sure why it's presented as an error.
3) When image is a JPEG with a Photoshop colour profile (ISSUE)
Error: Command failed: lcms: Error #12288; Corrupted memory profile
This is the real issue, and only happens on JPEG images with a Photoshop colour profile - can anyone point me to why this would happen?
Environment
OS X 10.9.4
GhostScript 9.07 at /opt/Ghostscript
compare at /opt/ImageMagick/bin/compare
Version: ImageMagick 6.8.8-6 Q16 x86_64 2014-02-17 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC
Delegates: bzlib fftw jng jpeg lcms lzma png tiff webp xml zlib
Thank you for your time.

Resources