Search code examples
iosretina-display

Save space: Batch resize down all @2x images for old iPhones/iPads/iPods on first launch


The issue with this: iphone 4 - loading images x old devices

Is that we end up filling our apps with double content, i.e., a user has to download both the 2x size and the 1x sized image to his device, but will eventually only use one of them and the other one will be a waste of download time etc.

So I thought, in some cases it could be okay with just filling your app with the high res images (@2x), and on app launch (in the app delegate, before displaying the window... Or something), you could batch scale all @2x images down for low res screen devices. When scaled down, you save those files to the device's documents and/or cache folder, and delete the original @2x images. How about that, did anyone do it already? Any downsides to this? Will Apple smack me somewhere for doing this? etc.


Solution

  • You definitely could batch scale those @2x images and save the scaled files to the documents folder. That would save download time, and use the same amount of space as bundling everything with your application, at the cost of some added complexity. I don't think that deleting the original @2x images is possible, however, or worth it even if it were - there's the possibility of moving apps and user data between devices. It would be the best just to choose the right data based on resolution, once you have them both. And I don't see much reason for Apple to smack you for doing this.

    Oh, and of course, if you really have a lot of data, in the order of hundreds of megabytes, doing two versions of the app might make sense (in the vein of Rage, for example).