Stairways Software
Excellence In Software For Over Ten Years – Only with a Mac
I've beat my head against installing ImageMagick far too many times. Its a powerful tool very useful for scripted image manipulation, but it has always been a royal pain to install.
The following describes how to install it under Mac OS X 10.6 (Snow Leopard) in 64 bit architecture (if applicable). All of the files are downloaded into ~/unix/install and all the components are installed in ~/unix/local, except for the perl modules, and (annoyingly) some ImageMagick man pages which refuse to honour the prefix, though no doubt there is some other magick (ha!) incantation that would force the man pages to the right location.
Although the code below is written like a script, you can’t (well, certainly shouldn’t) just run it as a script. For one thing, by the time I’ve finished writing this article, one or other of the components will likely have been updated. For another, you really should check that each part compiles and installs before proceeding. Its a slow and painful process, but a lot faster with a plan to follow.
Good luck!
mkdir ~/unix mkdir ~/unix/install cd ~/unix/install setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv LDFLAGS -L$HOME/unix/local/lib curl -O ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.1.tar.gz tar zxf tiff-3.9.1.tar.gz cd tiff-3.9.1 ./configure --enable-shared --prefix=$HOME/unix/local make make check make install cd .. curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.40.tar.gz tar zxf libpng-1.2.40.tar.gz cd libpng-1.2.40 ./configure --enable-shared --prefix=$HOME/unix/local make make install make check cd .. curl -O http://www.ijg.org/files/jpegsrc.v7.tar.gz tar zxf jpegsrc.v7.tar.gz cd jpeg-7/ ./configure --enable-shared --prefix=$HOME/unix/local make make check make install cd .. curl -O http://mirror.dknss.com/nongnu/freetype/freetype-2.3.9.tar.gz tar zxf freetype-2.3.9.tar.gz cd freetype-2.3.9 ./configure --enable-shared --prefix=$HOME/unix/local make make install cd .. curl -O http://internode.dl.sourceforge.net/project/ghostscript/GPL%20Ghostscript/8.70/ghostscript-8.70.tar.gz tar zxf ghostscript-8.70.tar.gz cd ghostscript-8.70 ./configure --disable-cups --prefix=$HOME/unix/local make make install cd .. curl -O http://www.vg.kernel.org/pub/mirrors/gentoo/source/distfiles/pkg-config-0.23.tar.gz tar zxf pkg-config-0.23.tar.gz cd pkg-config-0.23 ./configure --enable-shared --prefix=$HOME/unix/local CPPFLAGS=-I$HOME/unix/local/include LDFLAGS=-L$HOME/unix/local/lib make sudo make install cd .. curl -O ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.17.tar.gz tar zxf gettext-0.17.tar.gz cd gettext-0.17 ./configure --enable-shared --prefix=$HOME/unix/local CPPFLAGS=-I$HOME/unix/local/include LDFLAGS=-L$HOME/unix/local/lib make make install cd .. curl -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz tar zxf libiconv-1.9.2.tar.gz cd libiconv-1.9.2 ./configure --enable-shared --prefix=$HOME/unix/local CPPFLAGS=-I$HOME/unix/local/include LDFLAGS=-L$HOME/unix/local/lib make make install cd .. curl -O http://laotzu.acc.umu.se/pub/gnome/sources/glib/2.20/glib-2.20.5.tar.gz tar zxf glib-2.20.5.tar.gz cd glib-2.20.5 ./configure --enable-shared --prefix=$HOME/unix/local CPPFLAGS=-I$HOME/unix/local/include LDFLAGS=-L$HOME/unix/local/lib --with-libiconv make make install cd .. curl -O http://www.imagemagick.org/download/delegates/liblqr-1-0.1.0-1.tar.gz tar zxf liblqr-1-0.1.0-1.tar.gz cd liblqr-1-0.1.0 ./configure --enable-shared --prefix=$HOME/unix/local GLIB_CFLAGS=-I$HOME/unix/local/include GLIB_LIBS=-L$HOME/unix/local/lib make make install cd .. [sudo is needed to install some man pages and the perl modules] curl -O ftp://mirror.aarnet.edu.au/pub/ImageMagick/ImageMagick-6.5.7-6.tar.gz tar zxf ImageMagick-6.5.7-6.tar.gz cd ImageMagick-6.5.7-6 ./configure --enable-shared --prefix=$HOME/unix/local CPPFLAGS=-I$HOME/unix/local/include LDFLAGS=-L$HOME/unix/local/lib --with-perl make sudo make install cd ..
Posted Tuesday, November 10, 2009. Permalink. Post a Comment. Digg This
Recently on the Keyboard Maestro User Group someone asked how to open the finder selection in a specific application. Keyboard Maestro does not have a direct action for this, but you can easily add an Execute AppleScript text action to do this. Here is a simple script to do this.
tell application "Finder" to set finderfiles to selection as list
set finderaliases to {}
repeat with i in finderfiles
set a to i as alias
set finderaliases to finderaliases & a
end repeat
tell application "BBEdit"
activate
open finderaliases
end tell
Posted Sunday, July 12, 2009. Permalink. Post a Comment. Digg This
There are many different techniques for creating an NSImage from an NSView - finally I found one that works well!
There are various techniques:
But this only draws the root view, not subviews.
But its nigh on impossible to actually get the transformations correct for adjusting to the subview co-ordinate systems.
But this only gets the visible parts of the view.
But this is quite slow and has some drawing artefacts when the resulting image is displayed on the screen.
I finally found Gerd Knops’ post which yields a good result.
- (NSImage *)imageWithSubviews
{
NSSize mySize = self.bounds.size;
NSSize imgSize = NSMakeSize( mySize.width, mySize.height );
NSBitmapImageRep *bir = [self bitmapImageRepForCachingDisplayInRect:[self bounds]];
[bir setSize:imgSize];
[self cacheDisplayInRect:[self bounds] toBitmapImageRep:bir];
NSImage* image = [[[NSImage alloc]initWithSize:imgSize] autorelease];
[image addRepresentation:bir];
return image;
}
I am combining this with Matt Gemmell’s MGViewAnimation with good results for use in alpha fading views under 10.5.
Posted Tuesday, April 21, 2009. Permalink. 1 Comments. Digg This
I get a lot of value out of some of the technical blogs I read, such Mike Ash’s NSBlog and Matt Gallagher’s Cocoa with Love, as well as from sites like CocoaDev.
It is always good to return the favor and put out some useful information and in the past I have put information up on my personal web site, but I thought it was about time to create a proper developer oriented blog as a place to post technical information which is not directly related to our customers but which is related to what we are doing as a company.
Hence this blog.
I hope to post useful information related to whatever I am doing, especially related to anything that proves less that obvious on the first attempt and resists a google search to easily find the answers. Most of it will likely be related to Mac or iPhone programming, but occasionally it may stray in to other technical areas.
Posted Sunday, March 29, 2009. Permalink. Post a Comment. Digg This