2013-12-17 49 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並不是一個好主意。

相關問題