Friday, August 17, 2012

Building GraphicsMagick

GraphicsMagick is a powerful tool for processing image files. I'm using MinGW to build GraphicsMagick for Windows.




  1. zlib 1.2.7


    Download the zlib source (zlib-1.2.7.tar.gz) and unpack it.


    tar xzvf zlib-1.2.7.tar.gz
    cd zlib-1.2.7

    Compile and install zlib.


    make -f win32/Makefile.gcc
    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a /mingw/lib
    cp -iv libz.dll.a /mingw/lib


  2. bzip2


    Now download bzip2 source from bzip.org and unpack it.


    tar xzvf bzip2-1.0.6.tar.gz
    cd bzip2-1.0.6

    Change line 78 of bzlib.h to read:


    #if defined(_WIN32) && !defined(__MINGW32__)

    Compile and install bzip2.


    make
    cp bzlib.h /mingw/include/
    cp libbz2.a /mingw/lib


  3. liblzma


    Get the XZ Utils source code and unpack it. Go to the src/liblzma folder and compile liblzma like this:


    tar xzvf xz-5.0.4.tar.gz
    cd xz-5.0.4
    ./configure --prefix=/mingw
    cd src/liblzma
    make
    make install


  4. libpng 1.5.12 and libjpeg 8d


    Compile libpng and libjpeg as follows:


    ./configure --prefix=/mingw
    make
    make install


  5. libjasper


    Compile Jasper:


    ./configure --prefix=/mingw
    make
    make install

    If you encounter an error "undefined reference to _sleep", replace sleep() with _sleep with a factor of 1000 in the code:


    _sleep(1000)


  6. JBig


    Get jbigkit from here.


    make
    cp libjbig/*.h /mingw/include
    cp libjbig/*.a /mingw/lib


  7. libtiff 4.0.2


    Compile libtiff like this:


    ./configure --prefix=/mingw
    make
    make install

    If the shared library libtiff-5.dll is not generated and you want to create it manually, use such a command as the following and update libtiff.la accordingly:


    gcc -shared -o libtiff-5.dll -Wl,--out-implib,libtiff.dll.a -Wl,--whole-archive /mingw/lib/libtiff.a -Wl,--no-whole-archive -L/mingw/lib -ljpeg -ljbig -llzma -lz


  8. freetype


    Compile freetype:


    ./configure --prefix=/mingw
    make
    make install


  9. libxml2


    Compile libxml2:


    ./configure --prefix=/mingw
    make
    make install


  10. libwmf 0.2.8.4


    Compile libwmf:


    ./configure --prefix=/mingw
    make
    make install


  11. Little CMS


    Compile liblcms:


    ./configure --prefix=/mingw
    make
    make install


  12. Build GraphicsMagick


    Get GraphicsMagick code and build it like this:


    ./configure --prefix=/mingw --with-gs-font-dir='C:/Windows/Fonts' --with-windows-font-dir='C:/Windows/Fonts' LIBS='-ljbig'
    make
    make install



Creating a PDF document from JPEG files


GraphicsMagick comes in handy when you want to convert scanned JPEG images to a PDF document:


gm convert *.jpg doc.pdf

No comments:

Post a Comment

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger