GraphicsMagick: Difference between revisions

From Octave
Jump to navigation Jump to search
(→‎Building: run ldconfig in the end)
(→‎Dependencies: split the list and add new items)
Line 28: Line 28:
== Dependencies ==
== Dependencies ==
Compiling from source means tracking the dependencies yourself which may be a kind of painful. There's no wiki for GraphicsMagick so the following table hopes to makes things easier. Note however that this is the list of all dependencies and suggestions. For Octave purposes only, you definetely will not need all of these.
Compiling from source means tracking the dependencies yourself which may be a kind of painful. There's no wiki for GraphicsMagick so the following table hopes to makes things easier. Note however that this is the list of all dependencies and suggestions. For Octave purposes only, you definetely will not need all of these.
To start with you will obviously need the following
* a C compiler such as gcc
* a C++ compiler such as g++
* make
== Main dependencies ==
These are the ones which support being enabled or disabled via the configure script options and are shown in the summary status at the end of the configure script run. You will need them at compile time.


{| class="wikitable"
{| class="wikitable"
Line 34: Line 42:
|-
|-
| BZLIB            || libbz2-dev                      || libbz2-dev
| BZLIB            || libbz2-dev                      || libbz2-dev
|-
| dcraw            || dcraw                            || dcraw
|-
| dot              || graphviz                        || graphviz
|-
| fig2dev          || transfig                        || transfig
|-
|-
| FlashPIX          ||                                  ||
| FlashPIX          ||                                  ||
Line 48: Line 50:
|-
|-
| Ghostscript-fonts || gsfonts                          || gsfonts
| Ghostscript-fonts || gsfonts                          || gsfonts
|-
| gnuplot          || gnuplot                          || gnuplot
|-
| hp2xx            || hp2xx                            || hp2xx
|-
| html2ps          || html2ps                          || html2ps
|-
|-
| JBIG              || libjbig-dev                      ||
| JBIG              || libjbig-dev                      ||
Line 68: Line 64:
|-
|-
| PNG              || libpng12-dev                    || libpng12-dev
| PNG              || libpng12-dev                    || libpng12-dev
|-
| ra_ppm            || radiance                        || radiance
|-
| scanimage        || sane-utils                      || sane-utils
|-
|-
| TIFF              || libtiff5-dev                    || libtiff5-dev
| TIFF              || libtiff5-dev                    || libtiff5-dev
Line 87: Line 79:
|}
|}


You will also need to install g++ and gcc (or alternatives).


{{Note|DPS has been [http://dps.sourceforge.net/ deprecated] and should not be used hence why is not on the list.}}
{{Note|DPS has been [http://dps.sourceforge.net/ deprecated] and should not be used hence why is not on the list.}}
{{Note|Ghostscript library support is not recommended by GraphicsMagick hence why is not on the list.}}
{{Note|Ghostscript library support is not recommended by GraphicsMagick hence why is not on the list.}}
{{Note|there are both LCMS v2 and v1 but GraphicsMagick only needs one of them.}}
{{Note|there are both LCMS v2 and v1 but GraphicsMagick only needs one of them.}}
== Other dependencies ==
These other dependendies are easily added via a user-editable text file after building and installation. They are much more specific and most users will have no need for them.
{| class="wikitable"
|-
! Dependency        !! Debian Wheezy                    !! Ubuntu Precise
|-
| dcraw            || dcraw                            || dcraw
|-
| dvips            || texlive-base                    || texlive-base
|-
| dot              || graphviz                        || graphviz
|-
| fig2dev          || transfig                        || transfig
|-
| gnuplot          || gnuplot                          || gnuplot
|-
| hp2xx            || hp2xx                            || hp2xx
|-
| html2ps          || html2ps                          || html2ps
|-
| lp                || cups-client                      || cups-client
|-
| lpr              || cups-bsd                        || cups-bsd
|-
| mpeg2decode      ||                                  ||
|-
| mpeg2encode      ||                                  ||
|-
| pgpv              || pgpgpg                          || pgpgpg
|-
| povray            ||                                  ||
|-
| ra_ppm            || radiance                        || radiance
|-
| rawtorle          ||                                  ||
|-
| scanimage        || sane-utils                      || sane-utils
|-
|}

Revision as of 17:35, 26 August 2012

Octave will use GraphicsMagick for reading and writing your images (not plots, only if you are actually doing image processing). This means that the GraphicsMagick configuration you have on you system will limit what your Octave installation can do. Most systems will have it onn their repositories. Unfortunately, their configuration is not always the best for image analysis as it limits reading of images to 8-bit.


Building

See below for the reasoning behind each flag and tracking dependencies. Once done, the following commands should work to build GraphicsMagick.

./configure  --with-quantum-depth=32 --enable-shared --disable-static --with-magick-plus-plus=yes
make
make check
sudo make install
Info icon.svg
if after the build, you get "error while loading shared libraries: libGraphicsMagick.so.3: cannot open shared object file: No such file or directory" you need to run ldconfig. For security and performance reasons, Linux maintains a cache of the shared libraries installed in "approved" locations and this command will update it.

Quantum depth

The most common problem is the following warning when using imread():

warning: your version of GraphicsMagick limits images to 8 bits per pixel

The reason for this is that GraphicsMagick was compiled with --with-quantum-depth 8. Possible values are 8, 16 or 32, each implememnting that limitation. See the INSTALL file on GraphicsMagick sourcefor an explanantion of this. There has bugs reported requesting package maintainers to compile it with higher values. You should not create a new bug, instead leave a comment on the already open bugs: Debian, Ubuntu.

As versions with higher values are not available on the repositories, the solution is to compile it. Octave needs then to be recompiled to use the freshly compiled Magick++ library.

Magick++

Magick++ is the C++ application programming interface to GraphicsMagick. This is what Octave uses so you will need this when compiling GraphicsMagick. This will be enabled by default but if you don't have a C++ compiler installed (such as g++) GraphicsMagick will build just fine without a warning, just a small note during the run of configure.

Shared libraries

The default is to disable shared libraries but that won't work with Octave. You will need to pass the --enable-shared option. If you do not, Octave will give the following warning when running configure:

GraphicsMagick++ library fails tests.  The imread function for reading image files will not be fully functional.

Dependencies

Compiling from source means tracking the dependencies yourself which may be a kind of painful. There's no wiki for GraphicsMagick so the following table hopes to makes things easier. Note however that this is the list of all dependencies and suggestions. For Octave purposes only, you definetely will not need all of these.

To start with you will obviously need the following

  • a C compiler such as gcc
  • a C++ compiler such as g++
  • make

Main dependencies

These are the ones which support being enabled or disabled via the configure script options and are shown in the summary status at the end of the configure script run. You will need them at compile time.

Dependency Debian Wheezy Ubuntu Precise
BZLIB libbz2-dev libbz2-dev
FlashPIX
FreeType 2.0 libfreetype6-dev libfreetype6-dev
Ghostscript ghostscript ghostscript
Ghostscript-fonts gsfonts gsfonts
JBIG libjbig-dev
JPEG v1 libjpeg8-dev libjpeg-dev
JPEG-2000 libjasper-dev libjasper-dev
LCMS v2 liblcms2-dev liblcms2-dev
ltdl libltdl-dev libltdl-dev
LZMA liblzma-dev liblzma-dev
PNG libpng12-dev libpng12-dev
TIFF libtiff5-dev libtiff5-dev
TRIO
WMF libwmf-dev libwmf-dev
X11 libx11-dev libxext-dev libsm-dev
XML libxml2-dev libxml2-dev
ZLIB zlib1g-dev zlib1g-dev


Info icon.svg
DPS has been deprecated and should not be used hence why is not on the list.
Info icon.svg
Ghostscript library support is not recommended by GraphicsMagick hence why is not on the list.
Info icon.svg
there are both LCMS v2 and v1 but GraphicsMagick only needs one of them.

Other dependencies

These other dependendies are easily added via a user-editable text file after building and installation. They are much more specific and most users will have no need for them.

Dependency Debian Wheezy Ubuntu Precise
dcraw dcraw dcraw
dvips texlive-base texlive-base
dot graphviz graphviz
fig2dev transfig transfig
gnuplot gnuplot gnuplot
hp2xx hp2xx hp2xx
html2ps html2ps html2ps
lp cups-client cups-client
lpr cups-bsd cups-bsd
mpeg2decode
mpeg2encode
pgpv pgpgpg pgpgpg
povray
ra_ppm radiance radiance
rawtorle
scanimage sane-utils sane-utils