Why do we need these 3 particular image types?
If I have a button on my app with a background image say, 50 pixels x 50 pixels, why do I need 3 versions of this image? What's stopping me from just making one image that's much higher in res, say, 700x700 so when it shrinks down on any iPhone it won't fall under the max res the device would want?
Only thing I can think of is it just takes up more space, but for simple apps / a simple button it seems like it wouldn't cause any issues. I've tried it on a few devices and see no difference between them when I simulate it and do this method. However, as I dive more into apps and stuff I'm sure there is substance behind this technique.
If you don't have the exact size, there are two things that can happen:
Upscaling
#3x or #2x can be upscaled from #1x but usually the visual result is blurry, with thick lines and doesn't look good. Upscaling #3x from #2x can be even worse because subpixels must be used.
Downscaling
In general, the results are much better than with upscaling, however, that doesn't apply for all the images. If you have a 1px border on a #3x image, after downscaling it to #1x the border won't be visible (0.33px). The same applies for any small objects in the image. Downscaling destroys all details.
In general - for an image to look perfect, you want to avoid both downscaling and upscaling. You can always go with only #2x or #3x images and add other scales only if you see visual problems. Using higher resolution won't improve downscaling. High resolutions are used only to avoid upscaling. Downscaling from a high scale (e.g. #100x) to #1x won't create better results than downscaling from #3x.
You need 3 kinds of images in Image Assets because in terms of Scaling or Pixels
There are 3 kinds of Apple Devices (iPhone and iPad) that is
Normal device which terms to 1 pixel = 1 point#1x (Older iPhone and iPad devices)
Retina device which terms to 4 pixels(2 x 2) = 1 point#2x (iPhone 4+)
Retina iPhone6 and iPad which terms to 9 pixels (3 x 3) = 1 point#3x (iPhone6+)
Thus for providing same image in 3 scales iOS decides which image to show for which devices.Hope could help you understand this.
EDIT
It is because if you provide one high resolution graphic it would be waste of space on a users' device. Thanks to app slicing the device will download (from App Store) only the parts that actually fits the device (so retina device won't download non retina graphics). This is why Apple created assets catalogs and this kind of rules to follow. They describe it in their sessions.
In short it is to decrease memory/disk usage so it is all about increasing performance and user experience
First of all, you need to know points vs. pixels behaviour. On non-retina devices, point vs pixels ratio is 1point=1pixel. On retina devices, there are two ratios: 1point = 2x2 pixels depending on screen size, and 1point=3x3 pixels, because of pixels density, that is quadrupled watching on non retina. That's why you need this 3 types of images, to be shown on its highest resolution.
Complementing what Sulthan said:
Because you didn't propitiated proper images for a specific device, it has to downscale or upscale. These processes will use up your memory and processing, resulting maybe in a decrease of performance, depending on how many images at a time you're doing it and the size of image.
If you provide only one big image you encounter several problems:
Downscaling leads to the loss of quality (even if it is not huge)
It takes more computational power to downscale the image than to display the already pre-rendered image
The size of your binary gets increased and you are not able to benefit from app thinning which is introduced with iOS 9.
As you can see, producing only one image will impact the performance and quality of your app and it will disproportionately hit those with older devices. This is because:
They need to downscale more. Also, the performance of their devices is not as good as that of the new ones, so they are much more likely to notice the lags with your app
They do not have as much storage space so you really want to be able to use app thinning to help them
The loss of quality will be the highest for them and considering the fact that the resolution of their devices is low, they will notice it.
Due to this users are likely to be unhappy and this is bad for you. Because, from my experience, unhappy users are 10 times more likely to rate your app than happy users. You don't want that, do you? :)
Related
is it not enough to supply just 3x resolution image (e.g for a view or button) in Xcode so that it looks good on iPhone 5,6,and 6plus devices
( i.e leaving 1x and 2x in an image set blank )
My reasoning is that 1x image may look blurry on 6 plus but 3x image should look fine on 5
Basically i am asking so that i can communicate the same to my graphic designer and he should be fine with supplying a singe size rather than three sizes for all images
This got asked and answered many times regarding 2x assets, and the answer hasn't really changed (but it's hard to track down duplicate questions when I'm posting from my phone).
If you ship assets with a higher scale factor than the target device, they will display just fine. But downscaling them in real time has performance costs—they use more memory, they take longer to upload to the GPU, they take GPU time to render. Some of these costs are trivial, others aren't. (Remember, a 2x image is 4x the data of a 1x one, and a 3x image is 2.25x the data of a 2x one.) And they add up for every image in your app.
Most importantly, the devices with lower scale factors are the ones with less CPU/GPU/memory resources to spend on downscaling.
So, what to do? Well, if you don't want to have your artist deal with multiple scale factors, just order the 3x artwork and scale it yourself in Photoshop (or heck, even Preview) before you ship. It might not look as nice as if your artist tweaked it for each size, but it'll look about as good as real-time scaling without the run-time performance costs.
Or, with Xcode 6, you can put a PDF in your asset catalog, and Xcode will automatically generate PNGs for each size at build time. (This is an Xcode feature, not an iOS one, so it works even if you're targeting iOS 7.)
The problem with this idea is that in iOS 8 the iphone 4S is still supported and it has a different aspect ratio than every other iPhone. It renders at 320x480 at 2x so creating images to fit this wouldn't look grainy. The other 3 screen sizes would work if you go with the 3x scale which would be 1920x1080 for every page and just downscale the size for the 4in and 4.7in screens. You will likely need 2 story boards for the app (one for 3.5in and then the other for the 3 other screen sizes). Auto-sizing wouldn't really work in this case unless you changed the image of the UIImage because it would have a shortened length while maintaining the same width.
EDIT: changed the iPhone 6+ screen size to account for the 1.15x down scaling
and changed the rendering factor to match the comment below
I'm releasing a new update for one of my apps and I was disappointed to see that it just barely surpasses 20MB estimated size (20MB is the point where it can no longer be downloaded over cell data).
My app contains a lot of images, so I could greatly reduce the size if I didn't have all those non-retina images. I know that there are some non-retina devices that will be running my app. So here are my questions:
How will a non-retina device react if I have an image with the #2x suffix but no non-retina image without it.
If I use a retina sized image without the #2x suffix and scale it down to the size I want to display it at programmatically and/or
through interface builder, will it still maintain full quality on
retina devices? Will the quality be worse on a non-retina device
than using an image I downscaled from the original using GIMP
instead?
How will a non-retina device react if I have an image with the #2x suffix but no non-retina i
image without it.
I use that approach on a couple of apps of mine and it works flawlessly. I am not able to detect any performance or visual issues on non-retina display devices (concretely, iPad 1/2 and mini).
I am not sure what can happen on older iOS version, since I only support iOS5+ on those apps.
If I use a retina sized image without the #2x suffix and scale it down to the size I want to display it at programmatically and/or through interface builder, will it still maintain full quality on retina devices? Will the quality be worse on a non-retina device than using an image I downscaled from the original using GIMP instead?
This comes down to how you set interpolation options while doing the scaling. See this other question for more details on how interpolation quality affects scaling down an image. In GIMP or Photoshop you also have control on the interpolation to be used for scaling, btw.
But in the end I don't think you need to go this way.
Most importantly, that bandwidth limit has been raised to 50MB.
OK.
If you only provide one image then you have one of two possibilities.
The image is a non-retina image. This will look fine on the non-retina. It will look identical on a retina device. But will look low quality next to a retina image.
The image is a retina image. On the retina device it will still load as a retina image. It will look fine. However, on the non-retina device it will have to scale down the image. This takes extra cycles of the CPU so could affect performance and it may not look how you want. It may shrink the image using a different method than you want and so may make the image look odd.
This is the same with or without a suffix.
The best solution is to create retina images and then use your editor of choice to create the standard versions. Nothing will stop you only providing one image but it may lead to a look and performance that you don't want.
On a side note. The size for downloading over cellular data was increased to 50MB.
Try these things using the simulator and find out for yourself.
I think the answer is that UIImage will ignore the #2x choice if you're relying on [UIImage imageNamed:#"without2xSuffix.png"] and not find anything, but I haven't tried it. Deliberately requesting the #2x file will work, but whether the image will be scaled, tiled, stretched or centered (or something else) is up to the place where it's used.
Note that the documentation says that unless you use the name without the #2x suffix and let iOS find the 2x version for you, it will set the scale of the image to 1.0 rather than 2.0, which complicates drawing. You'd have to load the image using imageWithData:scale: to fix this.
I am developing a cocos2d game. I need to make it universal. Problem is that I want to use minimun amount of images to keep the universal binary as small as possible. Is there any possibility that I can use same images I am using for iphone, retina and iPad somehow? If yes, how can I do that? What image size and quality should it be? Any suggestion?
Thanks and Best regards
As for suggestions: provide HD resolution images for Retina devices and iPad, provide SD resolution images for non-Retina devices. Don't think about an all-in-one solution - there isn't one that's acceptable.
Don't upscale SD images to HD resolution on Retina devices or iPad. It won't look any better.
Don't downscale HD images for non-Retina devices. Your textures will still use 4x the memory on devices that have half or even a quarter of the memory available. In addition, downscaling images is bad for performance because it has to be done by the CPU on older devices. While you could downscale the image and save the downscaled texture, it adds a lot more complexity to your code and will increase the loading time.
There's not a single right answer to this question. One way to do it is to create images that are larger than you need and then scale them down. If the images don't have a lot of fine detail, that should work pretty well. As an example, this is the reason that you submit a 512x512 pixel image of your app icon along with your app to the App Store. Apple never displays the image at that size, but uses it to create a variety of smaller sizes for display in the App Store.
Another approach is to use vector images, which you can draw perfectly at any size that you need. Unfortunately, the only vector format that I can think of that's supported in iOS is PDF.
If you have an app that works fine on non retina devices, and then you deploy it on a retina device, without providing the requisite #2x images, what side effects could occur?
high memory usage? crashing of the application?
No, the events you mentioned will not occur. However, obviously your images will look terrible as they will not scale properly (therefore they will be pixelated and incorrect sizes etc.).
There isn't any point in not using retina images - all you have to do is add #2x to the images and double the image size, and they will scale correctly for both non-retina and retina display.
If you do not include #2x images, then the device will automatically stretch the image on a retina device to take up the same room (enlarge the image).
The scaling method that UIKit uses does not do any interpolation. Instead, it merely doubles the size of every pixel ("nearest neighbor" scaling). For images of squares with hard edges, that works fine. However, for photos or most artwork, the image ends up looking very pixelated (has artifacts).
Scaling the images up on a retina device is not performance intensive because of the simple scaling method that is employed. It is not likely to affect performance, only image quality.
If you include only high resolution images, they are not automatically scaled down for the non-retina device. Instead, for an UIImageView, for instance, you would set the view mode to Scale to Fill, so that the image scales down to fit the frame. However, again, UIKit uses the nearest neighbor, but when scaling down, artifacts are less noticeable.
The newer, retina devices are more performant, so they are able to handle high resolution images at the same speed as non-retina devices can handle the low resolution images, and scaling images up is trivial for them. However, older non-retina devices will simply be slower with high-resolution images which require more memory and more graphics power, especially since it has to scale them down as well.
This is very noticeable if you have high resolution images in a UITableView. Your retina device will scroll the table very smoothly, whereas you will notice some jitter on the non-retina device. It will not crash, it just won't be smooth. If the user experience is too bad, your app could be rejected. For static, non-moving images, there is unlikely to be much noticeable performance difference.
If you have room in your bundle, you should include both retina and non-retina images. Even if you simply double the image size in a nice photo editor like Photoshop to create your #2x images, the images will be of much nicer quality than what UIKit produces.
Remember that if your zipped app bundle is over 50 MB, it can only be downloaded via WiFi from the App Store. PNGs and JPEGs do not compress much since they are already compressed. That is one reason why you might choose to only include high resolution images (to keep the size of your app bundle down, especially for a universal app, where you might end up having 4 sets of images).
Of course you can provide only retina or even only non-retina images.
We did some testing on this matter a few month ago.
Only non-retina images resulted - as expected - in poor graphics. Even an non-trained eye could notice the blurrines.
Only retina images: it works. But memory footprint is bigger (for non-retina devices that would otherwise load non-retina images) and some lag could be noticed. Though we had to measure it to be sure.
To answer your question: zenith provided the answer. If you only provide non-retina images the graphics on retina devices will be blurry, but no low-memory condition could emerge because of this.
EDIT:
Unless you are doing some kind of research on graphics capabilities of different iOS devices i'd strongly suggest to provide both types of images: retina and non-retina.
If your designer is giving you hard time because of this you can do few things:
get a new designer
provide him some kind of tool to make his job easier: Unretiner for example
This has been bugging me for a while. I don't understand why one should include low-res images. If a 3GS, for example, can't find the low-res image, it just uses the #2x version anyway and displays it at it's native resolution. So why add to the filesize of your app by including all the half-res images?
Halley had it right. The system does not automatically downsample #2x images to non-retina size, and it shouldn't. The 3Gs does not have enough memory to load retina images. It will likely choke your app and cause it to exit with an out of memory error.
The problem gets even worse with the iPad 1. The iPad 1 has very low memory relative to it's screen size, and if you tried to make it load retina sized images, it would choke and die very quickly.
To scale an image the system has to load it at full size and do a complex scaling operation each time it draws it. It's the worst of all possible worlds - slower, 4x as much memory, and the images don't look as good.
In most cases, you can make an icon look better when created at the low-res resolution, instead of having the system scale it. If you don't care too much about how your icons look when scaled, then using the #2x version only is probably fine.
The other posters mentioned some excellent points, but here's one more for posterity: as mentioned several times in http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW1, a 2x image may be more detailed. In other words, the low-res image isn't simply a scaled-down version of the 2x image; the 2x image may contain details not present in the smaller image.
#2x filenames are intended for Retina Display enabled devices.
If you intend to use them for display on the iPhone 3GS make sure to properly test that they look as acceptable as the low-res image Apple wants you to use.
The reason being, is when images are scaled up if there is no #2x available, they can become pixelated and blurry, so you would prob think that making the original image twice as big would solve the problem.
But no, because the retina devices would still scale it up (in my experience) and non retina devices would display the image incorrectly.
It's got a lot to do with the quality standards Apple wants for the Apps on their app store