images.xcassets size is too large - ios

I am using xcode 6.0.1 and after setting all App Icons and Default Images my app size is jumped by 13 MB.
My App support iOS 5.1.1 and Later. Using Vector image don't support iOS 5.1.1 and iOS 6.x, I am not sure what i can do to reduce the build size.

Check list that might help you
->The first step is to look at your .app bundle and see what files inside it are taking up the most space.Before trying any optimizations, you should measure. This will tell you what to focus on improving.
->Use 8-bit Images Where Possible
Using an 8-bit PNG format where applicable can decrease your image size by a factor of 4 in comparison with 32-bit images. 8-bit images support a maximum of 256 different colors, so they should only be used images which use a small set of colors.
->Use High Compression for 32 bit Images Where Possible
Using Adobe Photoshop’s “Save For Web” feature can reduce the size of JPEG and PNG images considerably. By default, .png images will be compressed with pngcrush by Xcode automatically when the app is built.
->Check Your App, Usually apps contain extra files, like headers or a readme, that are never used.Be sure that you aren’t including any resources that aren’t used in your current project.
->Make sure dead code (code which is defined but never called) is stripped. Check that build setting DEAD_CODE_STRIPPING=YES.(Under your target build settings, then under "Linking" there is an option for "Dead Code Stripping". It defaults to yes for projects created with Xcode.
)
->What type of sounds files are you using? .caf files are incredibly large. As a general rule, you should compress audio using AAC or MP3, and experiment with a reduced bitrate. Quite often a 44.1khz sample is overkill and a lower-bitrate clip won't have a perceptible drop in quality.
->If you do not need to support iOS devices running all iOS versions.Specifying architecture/s to which the binary is TARGETED. This eliminates other architectures and reduces some size.
->Strip the binary of debugging and internal symbols (build settings STRIP_LINKED_PRODUCT=YES, STRIP_STYLE=all, DEPLOYMENT_POSTPROCESSING = YES).
->"Slender" tool will let you know the unused graphics in your app.
http://itunes.apple.com/us/app/slender/id493656257?mt=12
P.S. Before you make changes refer below source once.
Source:https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html
and https://developer.apple.com/library/ios/qa/qa1795/_index.html#//apple_ref/doc/uid/DTS40014195-CH1-MEASURE

I observed that when we drag and drop images in Assets folder, the system creates copy of them if you specified the image set to be Device Specific. E.g: If you specified an image "A" for iPhone and same image for iPad (individually), the system will maintain two copies of "A" rather pointing to one same image. In this way the size keeps on increasing because of duplicate images. Check for that also.

images.xcassets size is depends on the image size.Try to reduce the image size if you want to reduce the app size.You can un Zip the ipa file and check which component have larger size.Try to use png images instead of jpeg if used.

Related

Unity iOS App Size weighs 1.2GB (real size) (Android 100MB)

I have an app, that is made with unity 2d. Exporting it to android it weighs 100MB. Exporting it to iOS weighs 1.2GB (ipa is 104MB), but inside iTunes weighs 1.2GB, which is too much.
We tried to reduce the texture size, but then, images get very pixelated on the device.
Any ideas on how to fix this?
Here is what the .ipa uncompressed shows what is getting all the MB:
sharedassets4.assets (just that file, gets 342 MB)
iTunes shows the installation size, so if you unzip your ipa file, you will get those 1.2GB. The install size on Android could also that big. Did you check that?
Usually this happens when you compressed your texture in True Color or 16 bits and the zip compression works really well i.e. on textures that have a lot of pixels with the same colors.
Possible Solutions
1) if your textures don’t require transparency, you could switch to compressed Textures (PVRTC on iOS and ETC on Android). But if the require transparency, you should not switch to compressed because transparent PVRTC can look very ugly and ETC does not support alpha.
2) I don’t know if it is possible in your project, but you could try to reduce the amount of texture by using tint or slicing them.
UPDATE 1
I currently having a similar situation and as it turns out.
--------------------------------------------
| Platform Android iOS |
|--------------------------------------------|
| APK/IPA 380MB 400 MB |
| unzipped APK/IPA 1.19 GB 1.13 GB |
| install size on device 380MB 1.15 GB |
--------------------------------------------
The difference is that iOS unzips the IPA file completely on installation and
Android contrary reads during runtime directly out of the APK, so you could argue, that is not really installed, but it is definitely another installation type.
Check your texture import options. You may have different options set for Android import and iOS import.
iOS import is usually PVRTC, which prefers textures which are a power of two in size and square (256x256, 512x512, etc).
It sounds to me like you might have iOS set to a non-compressed format.
Did you compress your meshes? Also strip bit code. Another thing I found helpful is flattening your textures, and removing layers. Also changing the indexed color count to a lower amount. For 1024x1024 it can get to 170KB, if you tweak it right.
Also remove normal maps, and change your shaders. It won't look as granular, but it'll reduce the size. You may want to offload the textures to an Assets Server, too and get textures at runtime as opposed to preloading them in your bundled assets.

Reducing iOS App file size

I have made a very simple iPhone app with Xcode 6.1 and swift. I am really new to ios developing and ran into an app which in the end is 134 mb! of course this is not acceptable.
I have background images for all screen sizes which add up to 20 mb. and thats it! I am storing those images in xcassets, as thats the preferred way I guess.
the app shouldnt have more than 25 mbs, I think.
I figured out that I had some references doubled in my project. I removed these and still my .app file is 89 mbs!
What am I doing wrong? I read several threads on this, but nothing really helped!
What I did until now:
- reduce the size of all pngs
- disable the compress PNG option, as it seems to make the PNGs bigger (lol)
- configured the build settings to run the fastest and smallest build
- Strip Debug Symbols During Copy build setting to Yes (COPY_PHASE_STRIP = YES)
edit1: Apparenty Xcode does something weird with my pngs. Some of those pictures, that are 2 mb originally, are more than 10mb in the .app-file. What does xcode do there ?
It is actually not surprising that the Apple recompressed files are bigger. They are optimized for fast load not small size. If you do not care about size over speed, defiantly do turn off the compression. Even if you do care about speed you can do better than Apple.
https://imageoptim.com/xcode.html
So yes, turn off the PNG compression. The first thing I would do is build the ipa. An ipa is actually a zip file so build the ipa, copy it to a folder on your mac, rename the file with a .zip extension and double click on it. This will expanded it. Find the app in the Payload folder and right mouse click on it and choose show package contents. You will see all the assets. Sort by size. I am guessing you have overly large images. At that size my guess is that the extra size is likely to be caused almost entirely by the PNG files.
Consider using non retina images for some. Honestly most people wont notice. iOS will gracefully use the non retina on retina. This can save a ton of space,
Also consider using jpeg files instead of PNG for some of the files if you do not need transparency. Jpeg files are less efficient but can be much smaller. Compare both. Depends on the extent to which the images are continuous tone.
By default PNG file are 32 bit. 24 bit color and 8 buit alpha/transparency. You can save a bit of size by going to 24 bit. You can also save a lot of size going to 16 bit color or below. At 8 bit PNG files use a color lookup table. Play with Photoshop and the save for we options at PNG with bit depth 8 and below.
I have all sorts of expensive compressing software but often use the $8
https://itunes.apple.com/us/app/lossless-photo-squeezer/id704083918?mt=12
Try the 8 bit PNG option and the JPEG options.
EDIT
I did some research. I had always know Fireworks did better PNG compression. I did not realize that there was an 8bit PNG with an 8 Bit alpha channel. Photoshop supports 8 bit with a 1 bit Alpha Channel. I have always told people to use 32 bit PNG if their transparency needed more than 1 bit. In the future I will let them know the 8 bit with 8 bit alpha may be the better route, They just can use Photoshop for the final save of the file. They just need to save a 32 bit and compress elsewhere.
http://calendar.perfplanet.com/2010/png-that-works/
David

reducing my ios application size

I am developing my first app (iOS universal app), I want to reduce my app's size because it contains many images (png files) and sounds(mp3 files).
So my problem is:
How can I reduce the size of my app (images and sounds)?
Thanks!
Images:
Only include the basics in your app bundle (i.e. app icons, launch image, and possibly images for the first page)
Use Parse (or any other similar service) to download any additional images after the app is downloaded.
This approach will significantly decrease the size of your app but also let you pull down additional image files as needed.
Sounds:
What is the type of sounds files you're using? .caf files are incredibly large. Using .aifc files are just as good quality (to my untrained ear at least) and takes up significantly less space
Depends, compress png images to jpeg usually reduce app size, there are also image optimizers that compress pngs. If your images are part of the UI, tile them or stretch them really helps you in reduce app size and also memory usage. The image asset function in Xcode 5 helps in you in create resizable images.
For sounds the concept are pretty close to images, use compressed file audio as eckyzero said.
If your sounds and images aren't part of the UI but resources, you can make the app download them from the internet at first launch.

Use JPEGs for Launch Images

This is related to Default-Portrait.png for iPad: any way to make the file size smaller?
Is there any way to specify a more efficient file format (like JPEG) for Default-Landscape.png
and Default-Portrait.png?
Yes it's possible to use jpg files as launch images. Just add "Launch image" key with the base filename (e.g. LaunchImage.jpg") to the Info.plist. Then add files to your project such as
LaunchImage.jpg
LaunchImage#2x.jpg
LaunchImage-568h#2x.jpg
and Xcode will pick them up.
However through personal experience I've discovered if you're supporting the larger iPhone 5 screen the App Store expects PNG format and uses the presence of PNG to determine iPhone 5 support and display of iPhone 5 size thumbnails on the store. Using JPG images will not show the app as iPhone 5 optimized in the app store (even though it will work fine on the device) so it is best to stick with PNG.
There is no way to use an image other than a png.
All launch images must be PNG files and must reside in the top level of your app’s bundle directory. Section: App Launch (Default) Images
Update: JPEG images to work and Apple's documentation no longer specifies that the images must be PNG files.
If you use xcassets, then since Xcode 6 you can use JPGs. However Xcode will still not let you drop JPGs into the LaunchImage folder. But you can do it in Finder. Simply drop your PNGs into that folder with Finder and then edit the JSON file changing all .png extensions to .jpg.
I haven't submitted an app to the store using this yet, but it works in the iPhone simulator at least.
Update: Doesn’t work on the device. I’ll leave this answer here anyway so people know that this technique was at least tried so the effort won’t be repeated.

How to analyze ios ipa files info for reduce file size?

I want to reduce compiled file size of ios ipa file.
I get "How to reduce" way: How to reduce the size of my iPhone application?
But I want to know "How to analyze" way:
My image is
$ du /path/to/app
100 /path/to/app/images
150 /path/to/app/sounds
And I wan to reduce file size on effective point. Visualization is more good!:
http://www.lomont.org/Software/Utilities/DiskInfo/DiskInfo.png
I know I should delete files which is not used but is linked project...
I have used a tool called [ImageOptim] (http://imageoptim.com/xcode.html)
It incorporates a number of tools inside which crush your png files significantly (in my case it was between 25% to 50%) and had reduced the size of my app of around 0.6 mb
One thing to remember is to disable Xcode's PNG optimization.
There is no magic way to reduce the file size of ipa file.
What you can do to reduce the size are just as you said,
Remove any unnecessary files
If you have a lot of images, consider using PNGCRUSH to reduce file size of images
If you have a lot of sound files, consider using compressed audio file such as MP3, also, consider changing to mono instead of stereo. Bit rates of around 96K is still pretty decent.

Resources