Global Moxie

Skip Navigation
  • Home
  • Services
  • Blog
  • Projects
    • Big Medium
    • Books
    • Prototype.js PDF
    • Perl Critic for BBEdit
    • Project News
  • Help!
    • Big Medium FAQ
    • Support Forum
    • Big Medium Handbooks
  • Buy
  • About
Blog

Or search support forum

Skip Navigation

What's Global Moxie?

Global Moxie specializes in mobile design strategy and user experience for a multiscreen world. We offer consulting services, training, and product-invention workshops to help creative organizations build tapworthy mobile apps and effective websites. We're based in Brooklyn, NY. Learn more.

On Shelves

Books by Josh Clark

spacer

spacer

spacer

Moxiemail

Enter your e-mail to receive occasional updates:

News feeds
Home > Blog

Designing for iPhone 4's Retina Display

Tweet spacer E-mail this page spacer Print this page

Posted Jun 30, 2010

So, um, maybe you heard: there’s a new iPhone out. For my money (and I shelled out plenty for it), the phone’s best feature is the new “Retina display,” the eye-popping high-resolution screen. Everything they say about it is true: at 320 ppi, the pixels are just plain invisible. The crisp bright screen really looks as good as print, absolutely gorgeous.

But what soothes the eye also adds headaches for designers. For three years, the iPhone came in just one flavor of screen resolution: the 3.5-inch screen was always 320x480 pixels. The new phone doubles the resolution to 640x960 pixels. Suddenly, we’re all designing for two different screens. Fold in the iPad, and you’ve got three iOS screens to juggle. (Hey, it’s better than designing for Android phones, which will have around 60 different devices and form factors by year end, but still... device fragmentation has arrived in its own small way in iOS land.)

Apple’s done some nice work under the hood in iOS 4 to make this transition as easy as possible, but designers still have to take on some extra legwork. Here’s the gist.

spacer

I’ll Give You Two Pixels for That Point

Starting in iOS 4, dimensions are measured in “points” instead of pixels. Conveniently enough, the iPhone screen is 320x480 points on both iPhone 4 and older models. Since that matches the pixel dimensions on older phones, existing apps look and work the same on those phones in iOS 4 as they did in earlier operating systems. There, one pixel is one point, a one-to-one match.

In other words, dimensions for all the various elements of iOS 4 remain the same, but their units have changed: you just substitute points where you used to say pixels. (Ah, the travails of the hard-working tech writer; the new phone was unveiled just two weeks after my new book Tapworthy went to press. Though the 640x960 screen was already a foregone conclusion, it wasn’t yet clear how iOS would handle the new resolution, so I had to treat the matter with benign neglect. Alas, Tapworthy refers to all of its dimensions in pixels. If you have the book, just squint a little and pretend it says “points” instead.)

On iPhone 4, a point is two pixels; draw a one-point line, and it shows up two pixels wide. So: just specify your measurements in points for all devices, and iOS automatically draws everything to the right proportion on the screen. Text and images remain the same physical size on both old and new phones. That goes for bitmap images in legacy apps, too; iOS 4 blows ‘em up, automatically pixel-doubling them to adapt to the new phone’s resolution.

Of course, pixel-doubled images don’t take advantage of the gloriously crisp display on the new phone. That’s where your extra legwork comes in: to add high-resolution images to your app, you have to include a second set of all your graphic files. For every image in your app, add a second version that’s twice the size, adding @2x to the name. For a low-resolution image named image.png, for example, you would add a second file named image@2x.png. The new image will be picked up automatically by iPhone 4. Everywhere your code requests image.png (or even just plain old image), image@2x.png will be used instead.

Really? Yep, Really

I know what you’re thinking: “Do I really have to make two versions of my images? If I make a single high-resolution set, won’t iOS 4 scale them down on older devices?” Sorry, no, not automatically. While iOS 4 goes seamlessly in the other direction (scaling up low-res images for iPhone 4), it doesn’t work the other way. By default, it scales all images so that one pixel equals one point. That’s a great solution for making sure that old apps work correctly on the new phone, but it doesn’t help you go the other way ‘round.

While you could add additional code to downsize each and every high-res image for older devices, that would a) be a hassle, b) reduce performance, and c) create resized images that don’t look as good as the original. It might be extra work to create two sets of images for both old and new devices, but that’s the right way to go.

In practice, that means Photoshop fans should learn to get comfortable with Illustrator or [insert preferred vector application]. By building your app graphics in vector format, you can export them in whatever size you like with limited muss or fuss. This almost certainly won’t be the last time we see a new iPhone screen resolution emerge, and you can be ready for the next time by prepping all your graphics in vector formats. (Some folks, including Sebastiaan de With and Rusty Mitchell saw this coming a long time ago.)

There’s one exception to that: the app icon. Because of the wide variety of sizes and contexts in which your app icon appears, a pixel-perfect bitmap approach makes good sense. That’s particularly true for the tiniest versions, where the fabulous vector detail of your large icon will just scale down to mush. More on icon Photoshoppery in a sec. First, let’s get acquainted with the growing family of app icons that iOS requires for the various devices.

Boy Howdy, That’s a Lot of Icons

It used to be simple. You used to need just three icon sizes: a big 512px icon for the App Store, a 57px icon for the home screen, and a 29px icon for search results. Now, if you’re building a universal app for iPhone, iPhone 4, and iPad, you’ve gotta create 11 — eleven! — separate icons. And can you believe it: the mix even includes both 57x57 and 58x58 versions. Oh, the humanity. Here’s the rundown:

App Store Icon

  • 512x512 (scaled down to 175x175 for display in the store)

Application Icon

  • 114x114 (iPhone 4)
  • 57x57 (older iPhones)
  • 72x72 (iPad)

Spotlight Search Results and Settings Icon

  • 58x58 (iPhone 4)
  • 50x50 (Spotlight results for iPad)
  • 29x29 (settings for iPad and older iPhones)

Document Icon

This is a new icon type in iOS 4. It’s used if your app creates a custom document type. The iPad uses the document icon in two different sizes.

  • 320x320 (iPad)
  • 64x64 (iPad)
  • 44x58 (iPhone 4)
  • 22x29 (older iPhones)

Neven Mrgan to the Rescue

spacer

And finally, the promised icon Photoshoppery. The inimitable Neven Mrgan put together a handy Photoshop template to help make quick work of this app-icon assembly line. Highly recommended.

Meanwhile, Back on the Web

If you're designing mobile websites or web apps, you likewise need to do a tiny bit more work to show off your high-resolution prowess on iPhone 4. WaltPad has all the details on how to use CSS3 media queries to give iPhone 4 (and other high-res devices) their own special style sheets. Good stuff.

Tags: apple, design, graphics, ipad, iphone, mobile, tapworthy

Tweet Want more? Recent blog entries...

Comments

57 comment(s) on this page. Add your own comment below.

Dan
Jul 8, 2010 12:05am [ 1 ]

Astoudingly awesome post, thank you so much!

Benjamin Reid
Jul 8, 2010 2:37am [ 2 ]

Brilliant write up, I'll be reffering back to this!

mike
Jul 8, 2010 8:48pm [ 3 ]

People talk without full knowledge. Ok, I agree developers have to update their apps for iPhone 4 but for your information, not all developers are americans and for those living outside the USA, in countries that Apple are not selling not even the iPad yet, it is a little bit difficult to get in pace.

If Apple at least gave importance for foreigner developers, things would be easier.

SC
Jul 9, 2010 12:34am [ 4 ]

In case it helps, we put up a little web app to simplify the icon resizing for developers. Upload your 512x512 icon and it will generate the rest:

rdicongen.appspot.com/

kaishin
Jul 11, 2010 6:25am [ 5 ]

@SC thanks for the link, it's really handy!

Paul McDougall
Jul 16, 2010 5:53pm [ 6 ]

Thank you so much! I've been looking for a clear explanation of this for days! :)

Alex
Jul 23, 2010 6:33pm [ 7 ]

Thanks for putting all this info in the one place. Very handy - especially the icon section.

Sooners
Jul 26, 2010 5:41am [ 8 ]

I realize a new iPhone application, a web app. I developed it with web languages and I will switch to a native application. I know how to use the high resolution of the iphone 4 on a web app? :) Because the trick @ x2 does not, of course. I think if I pass in native and I save my images in 2 yours it will work (whatever), but some of my sites are not intended to become native app and would like to receive as a quick release a day "full compliant display retina." In the meantime, thank you in advance for those who bring me some answers! Have a nice day:)

PS: I'M FRENCH - - 'I hope you understand

Lee
Jul 26, 2010 9:48am [ 9 ]

Is there some reason why the @2x would not work? I've been running a test at lee.andron.com/test/indexsubmit.html and the larger image is not picked up on the iPhone 4 for me.

Josh Clark
Jul 26, 2010 10:00am [ 10 ]

@Sooners and @Lee: The @2x extension is only for native apps, not for web apps or websites. To use high-resolution images in websites for iPhone 4, you have to gin up some special CSS. You can target iPhone 4 using a CSS3 media query, putting your high-resolution images into a separate style sheet.

Walt Dickinson's article Targeting the iPhone 4 Retina Display with CSS3 Media Queries provides details on this approach, as does Aral Balkan's article How to make your web content look stunning on the iPhone 4’s new Retina display.

Hope that helps! Josh

Lee
Jul 27, 2010 6:45am [ 11 ]

Josh, thanks a bunch. Here is what I did to solve the problem... works well. (although I wish Apple had supported this in webkit as well) CSS:

frog { "mobile.tutsplus.com/tutorials/corona/corona-sdk-accelerometer/"> says with a cool picture showing it : "Depending on the device you have selected you will need to export the graphics in the recommended PPI, you can do that in your favorite image editor."

Fot newbies like me, it is quite confusing.

Tamas
Jan 20, 2011 9:25am [ 34 ]

Hi guys! Thank you for the great article! We are also new bodies in iPhone dev. Now i see that i have to use several icon types, but i cant find where can we put them to the app?? Now im ready to upload the binary in the app loader. But where can i insert the icons next to the 57px version?

john hansard
Feb 12, 2011 5:46am [ 35 ]

UHM, it QUADRUPLES the resolution - (x2 on the x-axis and x2 on the y-axis), not doubles! "the 3.5-inch screen was always 320x480 pixels. The new phone doubles the resolution to 640x960 pixels"

Matthew
Feb 27, 2011 12:43pm [ 36 ]

Awesome!

Husam
Mar 13, 2011 1:07am [ 37 ]

Doesn't work for me.

I had one picture 320x170 (image.png) and everything worked fine, but when I created a 640x340 (image@2x.png) and put it in resources no picture is displayed on the app.

Strange thing is, if I resize (image@2x.png) to 640x339 then it works, only I get a blurred image.

What am I doing wrong?

Husam
Mar 13, 2011 1:27am [ 38 ]

Regarding my previous post, my "test"-phone is running ios 3.1 or something. The pictures appear on the simulator (4.2) but no picture is visible on the iphone itself. What's confusing me is that pictures appear if I change the width or height by one pixel, as explained before.

Sorry to bother.

Husam
Mar 13, 2011 1:27pm [ 39 ]

Hello,

This method didn't work at first but after performing a clean build everything worked as described.

Sorry for cluttering up your blog, Josh. Please feel free to delete my previous posts.

ABDUL REHMAN
May 9, 2011 8:52am [ 40 ]

who can i creat a app icon for iphone 4

Carlos C
May 11, 2011 2:24pm [ 41 ]

Excellent post, thank you for taking the time to share!

Aleksandar
Jun 12, 2011 4:49am [ 42 ]

Thanks Josh Clark

This is great stuff. So many thinks are not spoken at apple page but clarified here.

Thanks a lot. Alex

chirag mistry
Jun 12, 2011 7:32am [ 43 ]

see htc droid

Russell
Jun 20, 2011 12:55pm [ 44 ]

What if you're creating graphics for a mobile website? Not an actual iPhone app. Do the same @2x principles apply? Or is that purely for native apps?

Josh Clark
Jun 21, 2011 3:26am [ 45 ]

Russell, have a peek at this comment above for links to resources that explain how it works for mobile websites.

brendan galea
Jul 12, 2011 8:15pm [ 46 ]

I'm making a native app and for some reason the higher quality images are not getting picked up. I've named each higher quality image the same name as the lower quality images with the "@2x" added on, and I'm running the program on the iphone 4.3 (retina) simulator. I might be missing something obvious, but as of right not I'm out of reasons for why this is not working.

brendan galea
Jul 12, 2011 11:28pm [ 47 ]

Ok, so I've discovered that the problem wasn't the @2x, but that older images that have been deleted that share the same name as newer images are being loaded instead of the updated images. How could I make the program run so that the newer images are being used instead of the older ones. I've tried restarting Xcode and my computer as well as doing a clean build. Any suggestions?

Luke Holder
Sep 15, 2011 7:59pm [ 48 ]

Excellent Post. It's not easy finding good resources and easy to follow breakdowns of the demands of apple. Thank God its not android i'm developing for. I have a question though...What resolution in terms of pixels per inch is recommended?, i mean both for the images within the app and the images for the icons. Most books i have, written for iPhone 3 development suggest 72ppi, but that doesn's show up as very crisp. Thanks for the article though, and keep em coming :)

Josh Clark
Sep 26, 2011 2:44pm [ 49 ]

iOS actually ignores the PPI resolution that you set, so don't worry about that too much. All you need to worry about is the overall pixel dimensions, not the dots per inch.

pilch
Sep 27, 2011 3:58am [ 50 ]

Fantastic article. I love stumbling across this kind of insight on the web. And although I haven't used it, the webapp mentioned above which converts 512x512 pngs into all the various other sizes one might need looks to be a real gem! Great work.

pilch
Sep 27, 2011 3:59am [ 51 ]

For those he can't be bothered to read up, that webapp is here: rdicongen.appspot.com/

Nick
Oct 1, 2011 1:55am [ 52 ]

Great article, thanks!

Just one question, if I want to display a photograph in Safari on the iPhone4 (in vertical orientation) and display it full screen (i.e. max visible width) what should the resolution of my photo actually be to make the most out of the Retina Display? How many pixels wide?

Thanks for your help!

Josh Clark
Oct 1, 2011 9:14am [ 53 ]

The iPhone 4 pixel size is 640x960, so that should be the minimum size of your photo for that device.

Darren
Oct 6, 2011 2:17pm [ 54 ]

Building a webapp for use on iPhone 4, I created static images of 500x150 for my opening screen. Using a standard img tag to show them, the simulator shows them extending off the right side of the screen by at least half the image. This happens if I use any of the simulator 'devices'. iPad/iPhone/iPhone 4.

I don't have any CSS controlling the width, i just can't get the simulator to show it properly.

Jack Dorsal
Oct 19, 2011 1:56am [ 55 ]

Dear Josh!

Thanks for this informative article.

I am dealing with a reverse scenario. My client has sent me a PSD of resolution 960 x 640 to slice the images for iPhone4. Now I have sliced all the images which are of high resolution.

Now what is the alternate to accommodate the high resolution images in iPhone 3GS. I don't want to create another set of images of 320*480.

Please respond as I believe that this scenario is missing in this article.

Regards, Jack D.

Josh Clark
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.