convert RGB image to grayscale

convert is a very powerful tool from the ImageMagick toolbox.

Here is how you can use it to convert an image to grayscale:


convert infile.png -channel RGBA -matte -colorspace gray outfile.png

This is especially handy in case you want to create a bitmap mask for use with iOS SDK. Indeed, you can create your mask in Photoshop (or whatever other image processing program you like) as a B&W image but without any concern for the actual format and  then the above conversion will ensure that the final image has the correct format.

Swiping and pinching with UIWebView

One of the most versatile classes that the iOS SDK offers is UIWebView. Indeed, it can be used as a very flexible tool to display a vast range of content types: rich text, graphics in SVG format, PDF files, and so on. It is also, IMO, the cornerstone of any sane approach to supporting multiple mobile platforms, e.g. iOS and Android. Inevitably, when you integrate UIWebView into your app, you come to face a problem: how you handle pinching and swiping correctly. As flexible as it is, in fact, UIWebView has got a major shortcoming in its “greediness” to touches: it wants them all and it handles it its own way, i.e., like a web browser would do. This is not what you want in most cases and this post will outline an approach to make UIWebView behave like any other views under iOS.

Google's Cookies and pundits everywhere...

Reading “Cookies and Privacy” by John Gruber, Daring Fireball, I was astound by the following line of reasoning that Gruber pointedly arguments against:

More animation transitions for iOS

I think that one of the most common deceptions for iOS developers is to discover how small is the set of default transitions that the iOS SDK support out of the box. There are just four of them: flip from left or right, and curl up or down. Well, I also think that all iOS developers also think that those four are simply the only <i>public</i> transitions in the SDK, but that there have to be more. But, you know, non public means rejection, a word that  no one likes.

Cocos2D and the new Retina iPad

The introduction of the new iPad, a.k.a Retina-iPad, or iPad 3, has made developing universal applications supporting all of iOS devices definitely more complex. This is mostly due to the requirement of providing artwork for 4 (four!) different resolutions: