Skip to main content
Inspiring
February 1, 2013
Answered

How to package ImageMagick binaries?

  • February 1, 2013
  • 1 reply
  • 3790 views

My plugin uses ImageMagick's convert and, rather than hassle users with downloading it themselves, I'd like to package it with the plugin. This seems straightforward for Windows since IM provides builds of convert.exe. OSX is not so clear since IM suggests building that from source. I'm not going to ask users to use Homebrew if I can avoid it and I don't want to provide my own build. Any tips from people here about what they've done to package IM tools?

db

This topic has been closed for replies.
Correct answer johnrellis

My Any File plugin uses ImageMagick's "composite" program, and it is bundled in the plugin distribution, for precisely the reasons you describe.  It was pretty painful for me, not being a Mac programmer, to figure out how to build ImageMagick without shared libraries, so that "composite" was completely self-contained.  Here are my notes on how to do that:

1. Download ImageMagick.tar.gz distribution to /Users/John.  Unpack it by
doing:

    cd /Users/John
    tar xvfz ImageMagick.tar.gz

See http://www.imagemagick.org/script/advanced-unix-installation.php

2. Download the jpegsrc.tar.gz library from:

    http://www.imagemagick.org/download/delegates/

to /Users/John/ImageMagick and unpack it with:

    cd /Users/John/ImageMagick
    tar xvfz jpegsrc.tar.gz
    mv jpegsrc<version> jpeg

3. Configure and build the jpeg library:

    cd jpeg
    ./configure --disable-shared
    make clean; make

4. Download the libpng.tar.gz library from:

    http://www.imagemagick.org/download/delegates/

to /Users/John/ImageMagick and unpack it with:

    cd /Users/John/ImageMagick
    tar xvfz libpng.tar.gz
    mv libpng<verszion> png

5. Configure and build the png library:

    cd png
    ./configure --disable-shared
    make clean; make

6. Configure and build ImageMagick; copy configure.sh to ImageMagick
folder and do:

    cd /Users/John/ImageMagick
    sh configure.sh
    make clean; make

7. Verify that composite is only loading dynamic libraries from /System and /usr/lib:

    otool -L utilities/composite

7. Copy utilities/composite and config/delegates.xml to anyfile.lrdevplugin.

And here's the contents of the "configure.sh" script referenced above:

# Image-magick configure script for configuring with Any File
# --disable-opencl \

./configure \
--disable-installed \
--disable-shared \
--enable-delegate-build \
--prefix=/ImageMagick-6.7.3-7 \
--disable-dependency-tracking \
--with-x=no \
--without-perl \
--with-freetype=no \
--with-jp2=no \
--with-tiff=no \
--with-magick-plus-plus=no \
--with-bzlib=no

1 reply

areohbee
Legend
February 1, 2013

Dunno, but I am interested in the answer if anybody else knows. Perhaps Tim Armes knows (he wrote LR/Mogrify) which depends on Image Magick and I *think* does not require pre-installation by Mac users.

johnrellis
johnrellisCorrect answer
Legend
February 1, 2013

My Any File plugin uses ImageMagick's "composite" program, and it is bundled in the plugin distribution, for precisely the reasons you describe.  It was pretty painful for me, not being a Mac programmer, to figure out how to build ImageMagick without shared libraries, so that "composite" was completely self-contained.  Here are my notes on how to do that:

1. Download ImageMagick.tar.gz distribution to /Users/John.  Unpack it by
doing:

    cd /Users/John
    tar xvfz ImageMagick.tar.gz

See http://www.imagemagick.org/script/advanced-unix-installation.php

2. Download the jpegsrc.tar.gz library from:

    http://www.imagemagick.org/download/delegates/

to /Users/John/ImageMagick and unpack it with:

    cd /Users/John/ImageMagick
    tar xvfz jpegsrc.tar.gz
    mv jpegsrc<version> jpeg

3. Configure and build the jpeg library:

    cd jpeg
    ./configure --disable-shared
    make clean; make

4. Download the libpng.tar.gz library from:

    http://www.imagemagick.org/download/delegates/

to /Users/John/ImageMagick and unpack it with:

    cd /Users/John/ImageMagick
    tar xvfz libpng.tar.gz
    mv libpng<verszion> png

5. Configure and build the png library:

    cd png
    ./configure --disable-shared
    make clean; make

6. Configure and build ImageMagick; copy configure.sh to ImageMagick
folder and do:

    cd /Users/John/ImageMagick
    sh configure.sh
    make clean; make

7. Verify that composite is only loading dynamic libraries from /System and /usr/lib:

    otool -L utilities/composite

7. Copy utilities/composite and config/delegates.xml to anyfile.lrdevplugin.

And here's the contents of the "configure.sh" script referenced above:

# Image-magick configure script for configuring with Any File
# --disable-opencl \

./configure \
--disable-installed \
--disable-shared \
--enable-delegate-build \
--prefix=/ImageMagick-6.7.3-7 \
--disable-dependency-tracking \
--with-x=no \
--without-perl \
--with-freetype=no \
--with-jp2=no \
--with-tiff=no \
--with-magick-plus-plus=no \
--with-bzlib=no

DFBurnsAuthor
Inspiring
February 1, 2013

Thanks, John.

Did you find any issues with OSX versions or will this produce a binary that works for a few versions back as well?