OS X Command line Image Manipulation

2009:01:24

“sips — scriptable image processing system”


    DESCRIPTION
    This tool is used to query or modify raster image files and ColorSync ICC profiles. Its functionality can also be used through the "Image Events" AppleScript suite.


’sips’ lives in /usr/bin/sips and is available on both Tiger and Leopard (OS 10.4, 10.5)

What is it ?  Its a command line tool that lets you quickly resize/resample and convert just about any image format file to a raster based format.  It even works with OS X icon files, .icns, and PDF formats.

In my case, I found this extremely valuable for creating PNG previews from existing PDF documents.

Example 1 – Convert PDF to PNG

sips -s format png mypdf.pdf --out myimage.png

Example 2 – Resize based on width restriction

sips --resampleWidth 64 myimage.png --out myimage-resized.png

Example 3 – Convert and Resize

sips -s format png --resampleWidth 64 mypdf.pdf --out myimage-resized.png

For more information, simply type ‘man sips’ at a terminal command line :)

Converting Multi-Page PDF Documents

I have put together a command-line-only solution for using sips to convert multi-page PDF documents, thanks to the comments by Brian below.

View the solution by proceeding to the following article ‘OS X Image Manipulation – Convert Multi-page PDF with sips and pdftk‘ or by reading the comments.


IE7, Flash Player 10 over SSL

2009:01:21

I just finished debugging an issue for a client that was unable to get their Flex application working with IE7 and Flash Player 10.

Apparently when Flash Player 10 came out, IE7 users started complaining about the application no longer working. The symptom was a gray box where the application should have loaded and if you right clicked the box, you got a menu with a grayed out ‘Movie not loaded’ item.

Turns out the issue is related to the client using a self-signed SSL certificate.

If you are running into problems with Flash Player 10 and IE7 check to see if you are using a self-signed SSL certificate.

If you are, you can stop chasing your tail and try to test against normal HTTP.


SWT 3.5M4 Carbon looking good on OS X

2009:01:02

First off, I am back in the Java/SWT world again.  Last time I was here, SWT 3.4 was just officially released and there were still plenty of gripes about building a truly native OS X experience.

A few days ago, I decided to give SWT 3.5M4 a whirl with the project that I’m working on and have to say that one of my biggest gripes has been addressed – table scrollbar areas!

SWT 3.5M4 Table - no more ugly scrollbar areas!

SWT 3.5M4 Table – no more ugly scrollbar areas!

Those that are familiar with coding in SWT on OS X know that you give up precious real estate on a Table widget if it *may* require scrollbars. The widget gets rendered with the scrollbar space ‘reserved’ and represented by a scrollbar background sans scrollbar.

My other big gripe is the window resize grip which is ALWAYS white.  SWT 3.5M4 appears to render a correct color resize grip in the Cocoa version but not the Carbon version.