我有一個帶有.png或.svg的BufferedImage。讓我們說這是128 * 128(image.GetHeight() image.GetWidth()
),我將其轉換爲字節數組是這樣的:BufferedImage字節數組大小
byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
和我的字節數組包含2048個字節(pixel.length)?
我想,其尺寸必須128×128 = 16384(所有像素)
餘馬試圖瞭解SVG和PNG存儲如何字節數組。我曾嘗試用1張像素圖片(黑色像素) - 的作品完美的字節數組大小爲1
如果你想要一個圖像的像素表示,請嘗試閱讀這篇文章:http://sanjaal.com/java/tag/java-image-pixel-representation/ –
你能提供這樣的圖像嗎? (可能是一個PNG,因爲SVG是一個矢量圖形,與BufferedImage無關...) – Marco13