5
edits
(→Main dependencies: OpenSUSE 13.2 packages) |
Waldyrious (talk | contribs) (copyedit / expand) |
||
Line 1: | Line 1: | ||
Octave will use [http://www.graphicsmagick.org/ GraphicsMagick] for reading and writing your images (not plots, | Octave will use [http://www.graphicsmagick.org/ GraphicsMagick] for reading and writing your images (not plots, unless you are actually doing image processing). This means that the GraphicsMagick configuration you have on you system will determine what your Octave installation can do. Most systems will have it on their own repositories. Unfortunately, their configuration is not always the best for image analysis as it can limit the bit depth when reading and writing of images. | ||
To solve the problem, GraphicsMagick needs to be rebuilt with the appropriate settings. See below for tracking dependencies and the reasoning behind each flag. Once done, the following commands should work to build GraphicsMagick. | To solve the problem, GraphicsMagick needs to be rebuilt with the appropriate settings. See below for tracking dependencies and the reasoning behind each flag. Once done, the following commands should work to build GraphicsMagick. | ||
<pre> | <pre> | ||
./configure | ./configure --with-quantum-depth=16 --enable-shared --disable-static --with-magick-plus-plus=yes | ||
make | make | ||
make check | make check | ||
Line 11: | Line 11: | ||
== Quantum depth == | == Quantum depth == | ||
The most common problem is the following warning when using {{Codeline|imread()}}: | The most common problem is the following warning when using {{Codeline|imread()}} or {{Codeline|imwrite()}}: | ||
<pre>warning: your version of GraphicsMagick limits images to | <pre>warning: your version of GraphicsMagick limits images to <N> bits per pixel</pre> | ||
...where {{codeline|N}} can be 8, 16 or 32. This warning means that GraphicsMagick was compiled with {{Codeline|--with-quantum-depth <N>}}, which implements that limitation. The [http://www.graphicsmagick.org/INSTALL-unix.html INSTALL-unix page] of GraphicsMagick documentation explains the rationale of this option. | |||
There are several bug reports requesting package maintainers to compile GraphicsMagick with higher values. You should not create a new bug; instead look for open bugs for your system, and leave a comment there. For convenience, here are the links for the bugs reported against [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557879 Debian], [https://bugs.launchpad.net/ubuntu/+source/graphicsmagick/+bug/696215 Ubuntu], and [https://bugzilla.redhat.com/show_bug.cgi?id=996411 Fedora]. | |||
{{warning|Increasing quantum depth may have a dramatic increase in memory usage. If you use QuantumDepth 32, all images will be read with that precision even if they were saved with 8bit. This means that a 100MB 8bit image will temporarily take 400MB memory, or more if the image was compressed and they usually are, before Octave resizes it back down to 100MB. Because of this, because 32 bit integers | As versions with higher values are not available on the repositories, there are two ways to address this. The easiest is to suppress the warning, as suggested in the [https://savannah.gnu.org/bugs/?45662 relevant bug report], if you know it won't affect your code. To do this, add the following command to your script: | ||
<pre>warning('off', 'Octave:GraphicsMagic-Quantum-Depth');</pre> | |||
The proper solution is to compile GraphicsMagick yourself, to pass the desired value to {{codeline|--with-quantum-depth}}. You will also need to recompile Octave to use the freshly compiled Magick++ library. | |||
{{warning|Increasing quantum depth may have a dramatic increase in memory usage. If you use QuantumDepth 32, all images will be read with that precision, even if they were saved with 8bit. This means that a 100MB 8bit image will temporarily take 400MB memory, or more if the image was compressed (and they usually are), before Octave resizes it back down to 100MB. Because of this, because images using 32 bit integers are rare, and because GraphicsMagick does not handle floating point, it's recommended to use QuantumDepth of 16.}} | |||
== Magick++ == | == Magick++ == |
edits