Quick way to resize images on the Mac through command line – SIPS

For one of my sites, I had a folder full of various sized images that I needed to go through and re-size. But I had other things to do, so I didn’t want to use a Photoshop Macro and all the overhead associated with it. So after searching, I found SIPS (Scriptable Image Processing System). As far as I know, this is only available on the Mac (or more detailed, Darwin), and is part of Leopard. The manual is dated April 2008, and I don’t have a Tiger or below machine to test this on.

Browsing through the manual, you can see SIPS has a ton of uses. Everything from converting formats, resizing, work with ColorSync profiles, and more. All I needed it for was just to re-size a bunch of images (which were already in JPG format).

  1. Made a backup of my original folder
  2. Opened up a Terminal.app window (This is under your /Applications/Utilities/ folder.
  3. Moved to the image directory (‘cd ~/Desktop/origImages/’)
  4. Called SIPS to re-size everything (‘sips –resampleHeightWidth 120 160 *.jpg’).

This command is just saying ‘re-size everything to 120 x 160 pixels with a file name ending in .jpg. If everything was in mixed formats (but still images), you could change *.jpg to *.*, which means ‘all file names and all extensions’.

The best part about SIPS is that it has very little overhead, but quite powerful at the same time. While running on our Core2Duo iMac (2.2Ghz, 3GB of RAM), It only took a few seconds for a couple hundered images. You can also easily create BASH scripts. You could easily write a script (and create a cronjob for it) to resize all images in a watch folder, then copy them to another folder, etc.

Finally, SIPS is easily integrated into AppleScript, without having to much ‘command line’ detail. You can reach most of its functionality from the Image Events parts of AppleScript.



Mac OS X 10.6 ‘Snow Leopard’ = genius.

Announced last week at Apple’s 2008 WWDC Keynote, Apple brought up a few new things, namely the iPhone 3G, MobileMe (the replacement to the 90’s like web application .Mac), and the announcement of Snow Leopard, Apples next step with the Mac OS X Operating System.

MobileMe is a cool idea, and I am glad they are finally moving on to something much nicer than .Mac. Its way overpriced (always has been), but for most people, it ‘just works’, and they are willing to pay that fee. The iPhone 3G is great too, finally bringing some much needed features to the phone. After the new features and the DRAMATIC price reduction (the new one will only be $199 with a new AT&T contract), Deb’s and I are actually thinking of making the switch, even paying our outrageous Verizon Wireless ETF. I may post more thoughts on the iPhone as that date gets closer…

But thats not really the topic of my post – its the last announcement, Snow Leopard, that is the BIG DEAL. For YEARS Apple has been toying with the enterprise, server environments, and even end users! From experience, you really had to push and bend the Mac OS in the past to integrate into some other services, always having the risk of something going wrong. Heck, even Apple’s documentation on many tools was not even correct, and would cause problems if you did not follow the book from the beginning. For Apple to step back, and really tighten up their code base, is dramatic. While to end users the change may not look that big, depending on the size of the project, this could be as big as the stop from OS 9 to X. From early reports, it looks like even PowerPC chips will no longer be able to run the Mac OS after 10.5.

According to Apple.com, the client version of the Mac OS is going to have full Exchange 2007 support. Now, more than ever, I wish we ran Exchange 2007 at work. The 64-bit improvements as well as better multi-core support will help the OS adjust to the growing cores per processor, making the system that more efficient (When multi-proc older PowerPC’s came out – they had to do something similar to make the Mac OS with with more than one processor).  Im sure that the few updates listed here are only the begining of what we will actually see, but well worth the wait. And of course, even with the huge changes between 10.4 and 10.5 (especially in things like ‘lookupd’ and the like), it would be great for Apple to expand and tighten up these tools even more.

As far as the Mac OS Server, various improvements seem to be coming there as well, including updates to newer Leopard only server features, including iCal Server, Wikis, Podcast Producer, and the Mail server (which I have heard great things about). I am sure we will also see vast improvements to its integration into the workplace as well. Apple has always been somewhat ‘so-so’ with the enterprise. the Xserve is an amazing piece of hardware, and I have enjoyed every one I have worked on. The Intel ones are a lot of fun, but I only ever got to work with beta versions of 10.5 on them. Other than cost, I would love to implement a leopard server at our office to solve SO many issues, as well as centralize a lot of products. Earlier this year, Apple actually dropped their Xserve RAID going with Promise, which can support the technology more than Apple could at the time (not that the Xserve RAID was bad, but would need a major overhaul to stay competitive).

Taking the time to really sharpen up their code, optimize their processes, etc is a  GREAT step. Most people know of course I have been using Macs for about 14 years or so now. Ive seen this OS change in so many ways. I have always felt that OS X really needed to be ‘cleaned up’, especially in the early days. Tiger was a GREAT change, but when you got deep down into the system, it was really becoming a mess. Early experience has show me the major changes in Leopard,  and it could only get better!

Listening To: ‘Discipline’ by Nine Inch Nails