iOS: how to reduce size of large PNG files

前端 未结 3 2025
攒了一身酷
攒了一身酷 2021-01-31 22:57

I\'m currently optimizing my iOS app for the new iPad. Unfortunately by adding launch images for the iPad retina display the size of my ipa grows from 1.2MB to

相关标签:
3条回答
  • 2021-01-31 23:41

    I'm using a great tool called ImageOptim

    It incorporates a number of tools inside which crush your png files significantly (in my case it was between 25% to 50%).

    One thing to remember is to disable Xcode's PNG optimization (as explained on the website)

    EDIT: Simply drag the images to the imageOptim window and the optimization will start automatically

    0 讨论(0)
  • 2021-01-31 23:46

    Ive struggled with this too, unfortunately not much can be done.

    In an effort to dramatically increase drawing performance of iOS apps, Xcode re-compresses PNG files as it builds. It premultiplies the alpha channel and byte swaps the red, green and blue channels to be sequenced blue, green and red. The result is optimised for iOS’s purpose, but as a side effect, ImageOptim’s work gets undone…

    Source

    0 讨论(0)
  • 2021-01-31 23:54

    I was able to get it down to 633KB with pngquant (64 colors with slight dithering, which is barely noticeable on regular screen, and should be absolutely invisible at Retina resolution) and ImageOptim.

    Yes, you will need to disable Xcode's conversion to avoid Xcode inflating files by converting them to ARGB.

    NB: the article quoted in the accepted answer provides no benchmarks at all for the claimed speed difference.
    It also contains correction that it is possible to optimize images with ImageOptim for iOS apps
    .

    0 讨论(0)
提交回复
热议问题