12

What makes an image 1x, 2x or 3x (@1x, @2x, @3x)? How can you make a 3x image?

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
Nathan Schafer
  • 273
  • 4
  • 15

4 Answers4

28

iOS uses points instead of pixels in its coordinate systems. In the original non-retina devices (iPhone, iPhone3G, iPhone3GS, iPad, iPad 2, iPad mini, and early iPod touches) one point in the coordinate system mapped to one pixel on the screen of the device. At that time, life was simple, you provided images to your app that mapped to the point size and everything looked great.

When Apple introduced the first retina display devices (iPhone 4, iPad with Retina Display, and iPod touch 4), the devices had 2 pixels for every point. Apple devised a clever way of dealing with this. The programmer just had to add a second image to their program with the increased resolution and add @2x to the name. No changes to the code were needed. If your code loads an image called "house", iOS will load "house" on a non-retina device (such as the iPad 2 or original iPad mini), and it will use "house@2x" for the retina devices. The iPhone 6 Plus has even higher resolution so it uses a @3x version.

So what makes an image @1x, @2x, or @3x? If your "house" image is 120 pixels by 90 pixels, then your "house@2x" image should be 240 by 180 pixels, that is twice the number of pixels in each dimension ("2x" for short). The "house@3x" version should be 360 by 270 (3 times the number of pixel in each dimension).

It's up to you to make sure that the @2x and @3x versions have more detail, and not just more pixels. You can use a program like Photoshop or Pixelmator to create your images. Start by creating the nice highly detailed version of your image (the @3x version), and then scale it down to the @2x resolution and save that version as your @2x version. Then open your @3x version again and scale it to the @1x resolution and save that as your @1x version. Add all three versions to the Assets Catalog in Xcode, and iOS will load the appropriate version for the appropriate devices.

vacawama
  • 150,663
  • 30
  • 266
  • 294
  • 1
    Thank-you for this answer. It makes sense! I have one question and I have photoshop. You said to start creating the @3x version of the image. How do I do this? Are their dimensions? A resolution? Can I make the image any size. Thanks for the answer. – Nathan Schafer Oct 26 '14 at 11:46
  • 4
    It's up to you how big you want your image to be on the screen. If your image is to be 50 points by 50 points on the screen of the app, make your 3x version 150x150, your 2x version 100x100, and your 1x version 50x50. So in Photoshop, you would create an new image with dimensions 150x150. After creating this image and saving it, you would rescale it by setting the image size to 100x100 and save that under a new name for the 2x version. Then reload the 150x150 version and set the image size to 50x50 and save that under a new name for the 1x version. – vacawama Oct 26 '14 at 11:56
  • Thanks I am grateful for your answer and will know tick it. Thanks! – Nathan Schafer Oct 26 '14 at 21:27
9

Read this to learn about the different resolutions:

http://www.paintcodeapp.com/news/iphone-6-screens-demystified

If you are looking for an inexpensive and easy way to create graphics, that will export in all three sizes, get Sketch 3:

http://bohemiancoding.com/sketch/

With Sketch you can make a graphic and then export it immediately in any size class you need.

Here are Photoshop step by step instructions for changing size. If you have a vector drawing - lines and other shapes - you can start at any size and increase or decrease the size. The three photos below show increasing an image size. If you have an image like a jpeg then you will want to start large and work smaller to avoid distortion.

enter image description here

enter image description here

enter image description here

Steve Rosenberg
  • 19,348
  • 7
  • 46
  • 53
0

There are plenty of online tool out there where you put the largest size there (1024x1024) and it will generate resized version for you. e.g. https://www.iconcutter.com

sarunw
  • 8,036
  • 11
  • 48
  • 84
0

You can also use Prepo mac application for different size images like 1x, 2x and 3x.

Prepo link of app store

You need to just add your image and you can export with different sizes of those images (Artwork). It also supports app icons also.