TinyURL was created here!
Backup, Restore, Customize and Clone your Raspberry Pi SD Cards (tutorial)
Check out sysmatt's script, i think it's exactly what you need.
A few more examples (you can scroll past the first bit):
Most involve using
'kpartx' / 'gparted' at some point, if you google that with 'raspberry pi' -
you find lots of examples, videos etc.
You can something like this to make the file sparse saving space
.cp -v --sparse=always pi.img ./tmp
A simple solution would probably be to compress the images. The empty space on the SD-card-image is probably represented by just 0's which would be really easy to compress. If I'm not mistaken, OSX comes with gzip2 pre-installed (a command line utility) altough I'm not sure about that.
There are a few ways to do this, here's a straightforward-ish one:
Shrinking images on LinuxWhen creating images from existing ISOs you often need to allocate a number of MB for the image to at least fit the files that are in the ISO. Predicting the exact size of the image is hard, even for a program. In this case you will create an image that is larger than actually needed: the image is much larger than the files on the image are combined.
This post will show how to shrink an existing image to a more optimal size. We will do this on Linux, since all required tools are available there: GParted,
Shrinking Raspberry Pi SD Card Images
Cloning a larger SD card to a smaller one (with a catch)