Look-alike for ImageMagick's "convert" and "mogrify" commands just for resizing images on Mac OS X.
Objective-C
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Shrink.xcodeproj
ImageMagickGeometry.h
ImageMagickGeometry.m
ImageMagickGeometryTest.h
ImageMagickGeometryTest.m
LICENSE
README.md
Shrink.1
Shrink.m
Shrink_Prefix.pch
Tests-Info.plist

README.md

Shrink

Much of the time the only thing your web application has to do with images is resize them, usually shrinking them down to specific sizes. In order to do that you have to install the giant ImageMagick library, plus bindings for whatever language you're interested in using it from.

This can be a headache.

You want to use this utility if:

  1. You use Mac OS X for development.
  2. You shell out to ImageMagick's convert or mogrify commands (this includes you, MiniMagick users) only for resizing images.
  3. Installing and configuring ImageMagick and language bindings leaves you wanting to pull out your hair.

Usage

The name of the binary produced by this project is Shrink:

sh-$ Shrink picture.jpg thumb.jpg 50%

But if you call it with convert or mogrify as the binary name, it'll act like those utilities:

sh-$ convert picture.jpg -resize 20x20 thumb.jpg

Example

In a Ruby on Rails application, you can call Shrink as convert in development and use the real convert in production. Maybe just copy Shrink to script/convert and put this in your environment files:

# development.rb
CONVERT_BINARY_PATH = "#{RAILS_ROOT}/script/convert"

# production.rb
CONVERT_BINARY_PATH = `which convert`

Then just use something like this to shell out:

def thumbnail(infile, outfile, size)
  system CONVERT_BINARY_PATH, infile, "-resize", size.to_s, outfile
end