I'm creating an universal app. For one screen, I'm displaying 6 images (png format) in a grid using this control. Also this screen supports both portrait and landscape orientation.
I've created a set of images in different resolutions for all the iDevices and named them using the correct naming convention as follows.
And I had to create another set of these images since I support both orientation and I can't use the same images as above because in landscape it would stretch.
Now I have close to 60 images for just for one screen and the app already weighs ~40MB! It goes without saying this is unacceptable.
My question is, is it necessary to create separate images for all these sizes/devices and orientations? Can't I create a set for just the retina display and will it scale down for normal displays? If that's not possible, is there a way to shrink the sizes of images?
Thank you.
There is no need to create images for both non-retina and retina display. You can use the "retina images" only (if possible, in JPG format). When you need to display the smaller size images, you can used "aspect fit" to scale down the bigger images. There may be some quality tradeoff.
Similarly, for iPhone 5 images, you can clipped the longer images using the clipsToBounds property to cut out the unwanted portions in smaller screens.
Is not obbligatory, but you should do or at least balance with other factors. The main issue if you don't is related to memory (RAM) issues, bigger images take a lot of space in memory and devices with lower resolution have less memory than retina ones. So shrinking is not the best option.
A possible solution would be take one "big" image that could be resized also for the others. To do that you need to redraw images using Core Graphics or ImageIO, this library could be useful NYXImagesKit. Of course there a price to pay:
There is another solution for GUI (not only) elements, use a PDF vect image. You can find an interesting article here by Matt Gemmel
If your images are not using alpha channel go with jpg!!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With