问题描述
我正在研究ipad的杂志查看器,我正在努力表现。
I'm working on a magazine viewer for ipad and I'm struggling with the performance.
我发现显示png最昂贵的部分是装载过程。
我知道xcode能够在构建期间优化png,并且这样的图像加载速度更快。但是我不能将所有图像都包含在构建中,因为它会很大。
I figured out that the most expensive part of displaying the pngs is the loading process.I know that xcode is able to optimize pngs during the build and such images are loaded much faster. But I can't include all images in to the build as it will be huge.
你知道如何优化任意png而不在构建过程中包含它吗?
Do you know how to optimize an arbitrary png without including it in the build process?
你知道iPhone的最佳格式是什么吗?我认为png应该使用RGB-8888配色方案,但我不确定还有什么重要。
Do you know what is the best format for iphone? I think that pngs should use RGB-8888 color scheme but I'm not sure what else is important.
也许你知道imagemagick的确切参数?
Maybe you know exact params for imagemagick?
推荐答案
我想我找到了一篇关于iphone png优化的好文章:
I think I've found a good article about png optimization for iphone:http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html
xcode使用此命令:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/iphoneos-optimize
It seams that xcode uses this command:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/iphoneos-optimize
上面的命令似乎使用pngcrush的修改版本来优化png并转换颜色通道:
/ Developer / Platforms /iPhoneOS.platform/Developer/usr/bin/pngcrush -iphone -f 0 orig.png optimized.png
It appears that the above command uses a modified version of pngcrush to optimize pngs and transform the color channels:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -iphone -f 0 orig.png optimized.png
优化真的很棒很有帮助。我有5倍的图像加载速度!
And the optimization is really helpful. I've got 5 time faster image loading!
这篇关于像xcode一样,为iphone / ipad显示器批量优化PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!