I have a question RE Retina display graphics (and potentially iPad 2 graphics if the rumours of double resolution displays are to be believed).
Is there any advantage to having two graphics:
Graphic.png 480x320
and
Graphic#2.png 960x640
and letting the iPhone use the #2 version for retina displays rather than just having Graphic.png at the higher res and letting iPhones with normal displays squash it?
Yes. If you didn't use two separate graphics (normal and "#2x"), any device without the retina display would have to store its graphics using four times as much memory. It's a simple matter of storing an insignificant amount of compressed images (PNGs) so you don't have to kill legacy devices' memory.
Not only that, but performance will drop from having to handle such large images on devices that are generally slower.
Finally, the result of scaling huge images is usually really ugly, because UIKit uses the nearest-neighbor algorithm when scaling.
Related
There are people who insist that for changing design from TFT to Retina we should redesign all app.
But I have read that we can change only app's images ,and it's enough.
I want to know which is the best practice for it and which solution is acceptable??
Retina Display is just Apple's name for the high resolution display on some of its devices -- it's still a TFT (thin film transistor) LCD display, though.
The Retina Display has twice as many pixels in each direction as the non-Retina version. iOS features a mechanism for providing both high resolution and standard resolution images, so that the high-res versions will be used if needed. All you need to do is include high-res versions of your images with the same names and their standard-res counterparts and the "#2x" suffix. Of course, having that higher resolution available means that you might want to add detail to your images or otherwise redesign your app to take full advantage of the screen's capabilities, but it's not a requirement. In fact, you don't need to do anything at all -- your existing app will work just fine without any changes.
It depends on your app.
In many cases simply including the hi-res versions of your images will be all that you need to do.
However, if you have any custom drawing that could benefit from the extra resolution, then you'll need to considered updating that code too.
Is there a way to not add 1x images to an iPhone/iPad app?
I'm developing an iPhone app and also testing on my iPad.
When I just use #2x images, the iPad successfully resizes down to the 1x size.
Is there any downside to not to add 1x images? Or are they still important?
By forcing the device to downsample, you're sacrificing performance and memory for a negligible amount of disk space. It's a really bad trade-off. Plus, downsampling a larger image on the fly on the device is likely to use a lower-quality downsampling algorithm than what's available in, say, Photoshop (for performance reasons).
I had an app with 100+ near-fullscreen photos, and dropping the #1x versions made possible to keep the app below the 50 MB limit for downloading over a cellular connection.
In my case, I had no choice, but as #Kevin Ballard mentions, perhaps the trade-off is not worth it. Remember that non-retina images are 25% the size of the retina ones, so in terms of pixels you are only going from 1.25 to 1.00.
Granted, with compressed images the relation might not be linear (i.e., #1x PNG/JPEG may weight more than 1/4 of the equivalent #2x image on disk).
I'm developing my software, all the ui is drawn based on 480x320 size screen, can my software run on iphone4 without any modification?
Yes it can run with no modification.
If you'd like to create "retina" assets you can create all of your images at the double resolution and include copies with '#2x' appended to the filename in your Application bundle. The iPhone will automatically load the correct images.
Example:
existing image - myImage.png
new up-sampled image - myImage#2x.png
Yes, but any images sized for the earlier iPhone models will look chunky compared to custom-designed iPhone 4 images.
Both the iPhone 4 and older devices are 320x480 points in size, which is the coordinate system that Core Graphics and UIKit uses. So your software will run the same.
Only the automatic scaling between your bitmaps and the display will be different. If you have bitmapped content or images, you can optionally provide #2x sized versions that will look somewhat smoother without the 2X scaling on iPhone 4 devices. This is nice, but optional.
Our graphics guy just gave me the sliced images for an Application we're building, but he only gave me the resolution for the 960x640 iPhone 4 res.
And advised that I can just scale the images down for 3g at runtime, so the resolution/image size remains the same but it's just displayed at half size.
The question: Is this allowed when submitting to the app store, or is it a requirement to have for example:
IMAGE1#2x.PNG (460x640) - iPhone 4
IMAGE1.PNG (230x320) - iPhone 3g
For all images.
I might just do the batch conversion and have two resolutions for all images, to save maximum space.
That's allowed, but obviously the images will occupy four times as much RAM on the older devices than they otherwise would, having four times the pixels. While the iPhone 4 has 512mb of RAM, the 3G and the original have just 128mb. Though assuming you are dealing with memory warnings correctly and everything will still fit, the main side effect will be performance issues whenever things are purged and later reloaded from disk (which, as I'm sure you're aware, is handled automatically for view controllers in NIBs). Based on empirical observations, the flash memory on pre-3GS devices is a lot slower than the later stuff so even if you're sticking with the large images it would make sense to attempt to minimise on-disk size.
Best practice that has worked for me is to make my retina image, then scale it down by 50%.
In order for the retina display to use the larger image, the #2x MUST be apart of the larger image. Your example is the way it should be used.
I would do the batch scaling ahead of time for sure. If for no other reason than the iPhone chooses whether or not to display the IMAGE1.PNG or the IMAGE1#2X.PNG depending on the resolution of the screen. In your code you always just reference IMAGE1.PNG. You don't have to make any coding changes. If you scale them at runtime you will have to override all of your calls to any UIImage type of thing.
IMHO, You are likely to miss one or else Apple is likely to release a different configuration of phone that will cause you to have to rework all of your code that is checking for screen resolution.
So I'm building an app for 4.x devices and I'm wondering if I can just use one set of assets at double resolution instead of one set with a #2x id and another set without.
Basically im asking can the older 3g and 3gs just use the #2x assets? and do the right thing with them?
anyone have experience with this?
Thanks
You're better off using two sets of resources, one for the high resolution retina displays and one for the older displays. Downsizing #2x graphics won't look pretty and will impact performance, especially on 2G iPod Touches.
The older devices can use the #2x but as far as I understand you'll need to:
Set your UIImageViews to scale the images to fit.
Hardcode image references to the new images.
Expect poor image quality and slower performance on non-retina devices.
Overall, it's better to provide two copies of the images, "bob.png" and "bob#2x.png" then reference them in code as "bob.png".
NB. As of iOS4 you can reference the images without their file endings, so just "bob" would work; however this has compatibility implications with devices running pre-iOS4 : the images won't be found. So for maximum compatibility include the file endings if you intend on deploying to both iOS4 and iOS3.x.
They technically can, given you make sure they're scaling the right way (e.g. if it's an image view that it's set to scale up/down).
However it's not recommended in most situations, mainly because it'll be slower, uses more resources, and leads to shorter battery life. Also, depends on your resources but an artwork scaled down by a factor of 2 doesn't have the same quality as one that is resampled specifically for the new size.