After adding a big picture (1.1 MB) to iPad app bundle, ipa file size changes from 2MB to 4.1MB. Can someone please explain why it happens and is it normal behaviour? I thought Xcode optimizes png files or am I wrong?
Related
Recently I'm trying to decrease my App's size of downloading.
The main bottleneck is that there is a .sqlite file built in my app's bundle, it costs about 21 mb.
While I successfully decreased the .sqlite file size from 21mb -> 17mb.
The install size report from iTunes connect did also decreased from 99.3mb -> 95.9 mb, but the download size increased about 200kb, as image shown below
And this is file size report after decreased .sqlite size
I have totally no idea of how this would happen, decreased Install size, but increased download size. I can swear that the only thing I've changed is the .sqlite file
Does anyone have a clue?
Thank you!
Environment:
Xcode 10.2.1
iOS 12 Base SDK
Pure Objective-C
Bitcode enabled
Optimization level: Fastest, Smallest
Currently, my Assets.xcassets folder is ~13MB with all images for my application. However, when I archive my app the Assets.car that results is closer to 33MB. When using iOSAssetExtractor as described here: What contributes to the size of assets in an IOS App and how can I shrink this? the issue appears to be that the PNGs are blowing up in size when they are "compressed" by Xcode. Many PNGs are 2-3x the size they were before going through the archiving process. This is a common problem that is referenced in multiple places.
The usual solution as referenced here: XCode png compression issue and here: https://imageoptim.com/xcode.html appears to be setting "Compress PNG Files" to No in build settings. This skips Xcode's unpacking and recompression of assets to avoid the asset size bloat that can be experienced. However, this doesn't appear to be working currently and might have stopped working in Xcode 7.3. There is a thread on this in the Apple forums here: https://forums.developer.apple.com/thread/43372 . However, the accepted solution appears to be changing the file type in the inspector to data which works for PNGs in a resources folder but does not appear to be an option for PNGs stored in an xcassets folder.
Note: I've also tried setting "Remove Text Metadata from PNG Files" to no as well with no success.
Can anyone recommend a solution for how to fix this issue in the current (7.3) version of Xcode so that my Assets.car file does not end up 2-3x larger than expected?
The specific problem of PNG sizes getting much larger seems to have been an Apple bug which appears to be addressed now. But, the more general problem of shrinking down each PNG to the smallest possible size is something that can still be solved more effectively. If you are interested in reading about a new delivery codec that can squeeze every last byte out of each PNG, then please have a look at this iOS framework.
the launch image is 1536x2048. it shows as 5MB in my folder. (launch image cannot use jpg.)
After I create IPA file, and open the IPA file package contents. I find my launch image size to be 5.2MB.
How do I reduce this SIZE????
I use imageOptim to reduce png from 5bm to 2mb. But xcode build option "compress png" actually undo that work. If I disable png compression, does it noticeably affect anything in my app?
Even 2MB is still too big. How can I reduce the final png inside IPA to be smaller? like 1MB max? Without sacraficing image quality?
Doesn't make any sense just a PNG launch image would force my app to be size 2MB already.
Well, I found a similar question : How to reduce filesize of gradient PNG?
And a service who providades that kind of service (minimize the size of your png file) https://tinypng.com/
Edit
And finally a question like yours:
iOS: how to reduce size of large PNG files
https://tinypng.com/
this does lossy compression pretty well for launch image there is no noticable difference.
It reduces 5MB file down to 1MB
We switched our XCode project over to use the Asset Catalog during a redesign. We needed several large background images, which we included in the asset catalog. The images were originally JPEGs that we renamed to PNGs to save space. The size of the images on disk is 19.1MB, but when we archive the app the Assets.car file that is generated is 6 times larger than that. I have tried using PNGs and compressing them, but the size is still huge. I'm not sure what else I can do.
It turns out that any image no matter what the original format is converted into a png during the archiving process. I moved the images to the old format of using images and the app size returned to normal.
Xcode "compresses" PNG files by default when building project. So if your JPEGs are renamed as .png, they will be converted to real PNGs then compressed.
This behaviour can be disabled. Just change Compress PNG Files option to NO in project build settings.
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.