Why are PNG images larger in the iOS app bundle than in my project?

后端 未结 3 948
感情败类
感情败类 2021-02-07 19:03

I am in the process of updating Hungry Helga (iPhone and iPad versions) for iOS 6, and all of the PNG files in my new app bundle archives are between 20 and 40 percent larger th

3条回答
  •  我在风中等你
    2021-02-07 19:35

    Using David H's script, I found that Xcode is also passing the command line parameter "-f 0" to pngcrush. The man page indicates that the "-f 0" will disable any IDAT filtering before compression which can result in a larger PNG file. Testing on my 1.9 MB example file from above confirms:

    pngcrush -iphone in.png out.png gives the 2.1 MB result that I am looking for

    pngcrush -iphone -f 0 in.png out.png yields the undesired 2.5 MB result

    Now the questions are: Why did Apple change this? Will it break image loading in some way if I work around it? If not, is there a setting for this in Xcode or will I always have to use a script to filter out the "-f 0" argument?

提交回复
热议问题