2013-12-17 52 views
1

我创建了一个png-8图像作为9-patch图像,这个图像在700 * 1200下只有16K左右。 打包后,我检查了结果资源文件,它变成了大约500K字节。我打开它,发现它改为PNG-24。我认为这是AAPT做到的。有没有人有任何线索为什么会发生这种情况? 从DOCAndroid aapt工具:为什么要将我的png8转换为png24

http://developer.android.com/guide/topics/graphics/2d-graphics.html#drawables

它只是说,它可能会做一些优化与PNG转换真彩色的8位之一。我只是不知道为什么会发生相反的情况......

------------------------ UPDATE --------- ------------

所建议的,我上传problomatic图像

enter image description here

+0

是否可以提供用于测试的PNG? – Kai

回答

0

investiagtion后,我发现了PNG是一个8位9patch之一。我发现了一个文章说

// If the image is a 9-patch, we need to preserve it as a ARGB file to make 
// sure the pixels will not be pre-dithered/clamped until we decide they are 

它可以在AAPT源代码Images.cpp

找到这样AAPT改变了8位PNG到真实的色彩之一。但请记住前提条件:9patch图像。所以创建一个8位9patch png并不是一个好主意。

相关问题