Jonathan Thomson's web journal

Enable Octave to Read 16 bit Images August 22, 2010

Filed under: Uncategorized — jethomson @ 4:05 am

This how to is a set of instructions for rebuilding libgraphicsmagick so it can process 16 bit images and rebuilding octave so it can take advantage of the new graphicsmagick libraries. This document assumes you’ve already installed octave using a package manager so that all of it’d dependencies have been resolved. Read over the entire how to before executing it. I do _not_ recommend you copy and paste it as a shell script and run it. Pay attention to each step and examine each command before hitting enter; I may have made a few typos.

su -c "apt-get install build-essential fakeroot"
su -c "apt-get build-dep libgraphicsmagick++3"

mkdir -p ~/src_tmp/{gm,oct}/src_pkgs
cd ~/src_tmp/gm/src_pkgs
apt-get source libgraphicsmagick++3
mv ~/src_tmp/gm/src_pkgs/graphicsmagick-1.3.12 ~/src_tmp/gm
cd ~/src_tmp/gm

#copy the following text into a file named rules.patch and save in ~/src_tmp/gm
--- graphicsmagick-1.3.12/debian/rules  2010-08-22 00:36:45.000000000 +0000
+++ debian/rules        2010-08-22 00:42:03.000000000 +0000
@@ -64,6 +64,7 @@
            ./configure $(gm_confflags) \
+               --with-quantum-depth=16 \
                --enable-shared \
                --enable-static \
                --enable-libtool-verbose \
#end copy
patch -p0 < rules.patch
cd ~/src_tmp/gm/graphicsmagick-1.3.12
debuild -i -us -uc -b
cd ~/src_tmp/gm

# install packages that resulted from debuild: 
# libgraphicsmagick++3 and libgraphicsmagick3 are required to run the octave binary
su -c "dpkg --install libgraphicsmagick++3_1.3.12-1_i386.deb libgraphicsmagick3_1.3.12-1_i386.deb"

# libgraphicsmagick++1-dev and libgraphicsmagick1-dev are needed to build octave from source
su -c "dpkg --install libgraphicsmagick++1-dev_1.3.12-1_i386.deb libgraphicsmagick1-dev_1.3.12-1_i386.deb"

# now start rebuilding octave from source
cd ~/src_tmp/oct/src_pkgs
apt-get source octave3.2
mv ~/src_tmp/oct/src_pkgs/octave3.2-3.2.4 ~/src_tmp/oct
cd ~/src_tmp/oct/octave3.2-3.2.4
debuild -i -us -uc -b
cd ~/src_tmp/oct
# install packages that resulted from debuild: octave3.2 and octave3.2-common
su -c "dpkg --install octave3.2_3.2.4-6_i386.deb octave3.2-common_3.2.4-6_all.deb"\