ํ์ผ ๊ตฌ์กฐ ¶
PNG ํ์ผ์ PNG ์๊ทธ๋์ฒ์ ์ฌ๋ฌ๊ฐ์ chunk๋ก ์ด๋ฃจ์ด์ง.
1. PNG file ์๊ทธ๋์ฒ ¶
- PNGํ์ผ์ ์ฒ์ 8๋ฐ์ดํธ๋ ๋ค์์ ์ญ์ง ๊ฐ๋ค๋ก ์์.
137 80 78 71 13 10 26 10
2. Chunk Layout ¶
- ๊ฐ chunk๋ ๋ค ๋ถ๋ถ์ผ๋ก ๋๋์ด์ง๋ค.
- Length : 4๋ฐ์ดํธ. Length, Chunk Type, CRC ๊ธธ์ด๋ ํฌํจ๋์ง ์์ ๊ฐ์ด๋ค.
- Chunk Type : 4๋ฐ์ดํธ. ๋ฐ๋์ ์ํ๋ฒณ์ด์ด์ผ ํจ(ํธ๋ฆฌํจ. ๊ฐ๋
์ฑ์ ์ํด). ์์ฝ๋, ๋์ฝ๋๋ ์ด ๊ฐ์ ์ด์ง ๊ฐ์ผ๋ก ์ธ์ง.
- Chunk Data : Type ์ ๋ฐ๋ฅธ ๋ฐ์ดํฐ. ๊ธธ์ด๊ฐ 0์ผ์ ์์.
- CRC : Chunk Type + Chunk Data ์ ๋ํ 4 ๋ฐ์ดํธ CRC ๊ฐ.
- Length : 4๋ฐ์ดํธ. Length, Chunk Type, CRC ๊ธธ์ด๋ ํฌํจ๋์ง ์์ ๊ฐ์ด๋ค.
3. Chunk ์ด๋ฆ์ง๊ธฐ ๊ท์น ¶
4. CRC ์๊ณ ๋ฆฌ์ฆ ¶
5. Chunk Spec. ¶
- ์ ์ผ ์ฒ์์๋ IHDR chunk๊ฐ ์ค๋๋ฐ, ๋ค์์ ์์๋ก ์ด๋ฃจ์ด์ ธ ์๋ค.
- Width : ํฝ์
๋จ์์ ์ด๋ฏธ์ง ๋๋น
- Height : ํฝ์
๋จ์์ ์ด๋ฏธ์ง ๋์ด
- Bit depth : ํ๋์ ์ํ(ํฝ์
๊ณผ๋ ๋ค๋ฅธ๊ฐ๋
)๋น ๋๋ ํ๋ ํธ ์ธ๋ฑ์ค๋น ์ฐ์ด๋ ๋นํธ์ ์
- Compression method : ์ด๋ฏธ์ง ๋ฐ์ดํฐ๋ฅผ ์์ถํ๋๋ฐ ์ฐ๋ ๋ฐฉ๋ฒ
- Filter method : ์ด๋ฏธ์ง ๋ฐ์ดํฐ์ ๋ํ ์ ์ฒ๋ฆฌ ๋ฐฉ๋ฒ. Compression๊ณผ ๊ด๋ จ.
- Interlace method : ์ด๋ฏธ์ง์ ๋ํ ๋นํธ์ค๋.
Color Type Allowed Bit Depths Interpretation 0 1,2,4,8,16 Each pixel is a grayscale sample. 2 8, 16 Each pixel is an R, G, B triple. 3 1, 2, 4, 8 Each pixel is a palette index; a PLTE chunk must appear. 4 8, 16 Each pixel is a grayscle sample, followed by an alpha sample. 6 8, 16 Each pixel is an R, G, B triple, followed by an alpha sample.
- Width : ํฝ์
๋จ์์ ์ด๋ฏธ์ง ๋๋น
- PLTE chunk : 256๊ฐ์ ์ํธ๋ฆฌ๋ฅผ ๊ฐ์. R, G, B ์์)
- IDAT chunk : ์ค์ ํฝ์
๊ฐ. IDAT๋ ์ฌ๋ฌ๊ฐ๊ฐ ์ฌ ์ ์๋ค. (see also PNGFileFormat/ImageData)
- IEND chunk : ๋ฐ๋์ ์ด chunk ๋ก ๋๋์ผ ํจ. Data ๊ธธ์ด๋ 0.
Summary ¶
Name | ์ฌ๋ฌ๊ฐ ํ์ฉ? | ํ์ผ์์ ์์น ์ ์ฝ |
IHDR | x | ๋ฐ๋์ ์ ์ผ ์์ ์์ผํจ (์ฒ์์ 8๋นํธ ์ ์ธ) |
PLTE | x | IDAT์ ์ ์์ผํจ |
IDAT | o | ์ฌ๋ฌ๊ฐ๊ฐ ์ฌ์ฉ๋๋ค๋ฉด ๋ฐ๋์ ์ฐ์์ ์ด์ด์ผ ํจ |
IEND | x | ๋ฐ๋์ ์ ์ผ ๋์ ์์ผ ํจ |
PNGFileFormat