• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to package ImageMagick binaries?

Participant ,
Feb 01, 2013 Feb 01, 2013

Copy link to clipboard

Copied

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

TOPICS
SDK

Views

3.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 01, 2013 Feb 01, 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

...

Votes

Translate

Translate
LEGEND ,
Feb 01, 2013 Feb 01, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2013 Feb 01, 2013

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 01, 2013 Feb 01, 2013

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2013 Feb 01, 2013

Copy link to clipboard

Copied

There was a mysterious problem when OS X Lion came out in 2011, which was fixed by rebuilding the program:

http://forums.adobe.com/message/4037469#4037469

It appeared to be backward compatible with previous versions of Mac OS.  I haven't been able to do disciplined testing, so I rely solely on user reports. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 02, 2013 Feb 02, 2013

Copy link to clipboard

Copied

I've been through the same process for Focus Mask and I have pretty much same options. 

At first release, I made the error of using "builtin" libpng (/usr/X11/lib/libpng.dylib) but that is actually just a stub if the user hasn't installed X11 runtime and it only displays X11 error dialog.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 10, 2013 Feb 10, 2013

Copy link to clipboard

Copied

Following up on this, this was great info and went pretty smoothly. The hiccup was when I wanted to include TIFF support since I need that. It wasn't as trivial as the jpeg or png delegates and also required tweaks to the main IM build. Here are my supplemental notes:

- Using the same pattern of commands as for the jpeg and png libraries above, download the latest tiff library from the IM site, unzip/untar it, and rename the directory to tiff/

- cd to tiff

- Config the TIFF build using "./configure --disable-shared --disable-lzma"

- run the build: "make"

- cd .. to the IM directory

- Use John's configure.sh file as above but add the following:

    --disable-opencl --with-tiff=yes --without-lzma CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"

- run the build: "make"

- as with John's notes, run otool to verify no non-core dependencies.

If it matters, I was using Xcode 4.6 and gcc version 4.2.1.

db

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 10, 2013 Feb 10, 2013

Copy link to clipboard

Copied

LATEST

Good, thanks for the additional notes. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines