Commit ca0d4830 authored by Mikael Tillenius's avatar Mikael Tillenius Committed by Nigel Tao

image/png: support for more formats

Added support for reading images with grayscale + alpha and
for images with depth 1, 2 or 4.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4174053
parent c015dd21
...@@ -29,11 +29,19 @@ const ( ...@@ -29,11 +29,19 @@ const (
// A cb is a combination of color type and bit depth. // A cb is a combination of color type and bit depth.
const ( const (
cbInvalid = iota cbInvalid = iota
cbG1
cbG2
cbG4
cbG8 cbG8
cbGA8
cbTC8 cbTC8
cbP1
cbP2
cbP4
cbP8 cbP8
cbTCA8 cbTCA8
cbG16 cbG16
cbGA16
cbTC16 cbTC16
cbTCA16 cbTCA16
) )
...@@ -70,6 +78,7 @@ type imgOrErr struct { ...@@ -70,6 +78,7 @@ type imgOrErr struct {
type decoder struct { type decoder struct {
width, height int width, height int
depth int
palette image.PalettedColorModel palette image.PalettedColorModel
cb int cb int
stage int stage int
...@@ -138,7 +147,29 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro ...@@ -138,7 +147,29 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro
return UnsupportedError("dimension overflow") return UnsupportedError("dimension overflow")
} }
d.cb = cbInvalid d.cb = cbInvalid
switch d.tmp[8] { d.depth = int(d.tmp[8])
switch d.depth {
case 1:
switch d.tmp[9] {
case ctGrayscale:
d.cb = cbG1
case ctPaletted:
d.cb = cbP1
}
case 2:
switch d.tmp[9] {
case ctGrayscale:
d.cb = cbG2
case ctPaletted:
d.cb = cbP2
}
case 4:
switch d.tmp[9] {
case ctGrayscale:
d.cb = cbG4
case ctPaletted:
d.cb = cbP4
}
case 8: case 8:
switch d.tmp[9] { switch d.tmp[9] {
case ctGrayscale: case ctGrayscale:
...@@ -147,6 +178,8 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro ...@@ -147,6 +178,8 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro
d.cb = cbTC8 d.cb = cbTC8
case ctPaletted: case ctPaletted:
d.cb = cbP8 d.cb = cbP8
case ctGrayscaleAlpha:
d.cb = cbGA8
case ctTrueColorAlpha: case ctTrueColorAlpha:
d.cb = cbTCA8 d.cb = cbTCA8
} }
...@@ -156,6 +189,8 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro ...@@ -156,6 +189,8 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro
d.cb = cbG16 d.cb = cbG16
case ctTrueColor: case ctTrueColor:
d.cb = cbTC16 d.cb = cbTC16
case ctGrayscaleAlpha:
d.cb = cbGA16
case ctTrueColorAlpha: case ctTrueColorAlpha:
d.cb = cbTCA16 d.cb = cbTCA16
} }
...@@ -169,7 +204,7 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro ...@@ -169,7 +204,7 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro
func (d *decoder) parsePLTE(r io.Reader, crc hash.Hash32, length uint32) os.Error { func (d *decoder) parsePLTE(r io.Reader, crc hash.Hash32, length uint32) os.Error {
np := int(length / 3) // The number of palette entries. np := int(length / 3) // The number of palette entries.
if length%3 != 0 || np <= 0 || np > 256 { if length%3 != 0 || np <= 0 || np > 256 || np > 1<<uint(d.depth) {
return FormatError("bad PLTE length") return FormatError("bad PLTE length")
} }
n, err := io.ReadFull(r, d.tmp[0:3*np]) n, err := io.ReadFull(r, d.tmp[0:3*np])
...@@ -178,7 +213,7 @@ func (d *decoder) parsePLTE(r io.Reader, crc hash.Hash32, length uint32) os.Erro ...@@ -178,7 +213,7 @@ func (d *decoder) parsePLTE(r io.Reader, crc hash.Hash32, length uint32) os.Erro
} }
crc.Write(d.tmp[0:n]) crc.Write(d.tmp[0:n])
switch d.cb { switch d.cb {
case cbP8: case cbP1, cbP2, cbP4, cbP8:
d.palette = image.PalettedColorModel(make([]image.Color, np)) d.palette = image.PalettedColorModel(make([]image.Color, np))
for i := 0; i < np; i++ { for i := 0; i < np; i++ {
d.palette[i] = image.RGBAColor{d.tmp[3*i+0], d.tmp[3*i+1], d.tmp[3*i+2], 0xff} d.palette[i] = image.RGBAColor{d.tmp[3*i+0], d.tmp[3*i+1], d.tmp[3*i+2], 0xff}
...@@ -206,7 +241,7 @@ func (d *decoder) parsetRNS(r io.Reader, crc hash.Hash32, length uint32) os.Erro ...@@ -206,7 +241,7 @@ func (d *decoder) parsetRNS(r io.Reader, crc hash.Hash32, length uint32) os.Erro
return UnsupportedError("grayscale transparency") return UnsupportedError("grayscale transparency")
case cbTC8, cbTC16: case cbTC8, cbTC16:
return UnsupportedError("truecolor transparency") return UnsupportedError("truecolor transparency")
case cbP8: case cbP1, cbP2, cbP4, cbP8:
if n > len(d.palette) { if n > len(d.palette) {
return FormatError("bad tRNS length") return FormatError("bad tRNS length")
} }
...@@ -214,7 +249,7 @@ func (d *decoder) parsetRNS(r io.Reader, crc hash.Hash32, length uint32) os.Erro ...@@ -214,7 +249,7 @@ func (d *decoder) parsetRNS(r io.Reader, crc hash.Hash32, length uint32) os.Erro
rgba := d.palette[i].(image.RGBAColor) rgba := d.palette[i].(image.RGBAColor)
d.palette[i] = image.RGBAColor{rgba.R, rgba.G, rgba.B, d.tmp[i]} d.palette[i] = image.RGBAColor{rgba.R, rgba.G, rgba.B, d.tmp[i]}
} }
case cbTCA8, cbTCA16: case cbGA8, cbGA16, cbTCA8, cbTCA16:
return FormatError("tRNS, color type mismatch") return FormatError("tRNS, color type mismatch")
} }
return nil return nil
...@@ -240,7 +275,7 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) { ...@@ -240,7 +275,7 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) {
return nil, err return nil, err
} }
defer r.Close() defer r.Close()
bpp := 0 // Bytes per pixel. bitsPerPixel := 0
maxPalette := uint8(0) maxPalette := uint8(0)
var ( var (
gray *image.Gray gray *image.Gray
...@@ -253,40 +288,50 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) { ...@@ -253,40 +288,50 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) {
img image.Image img image.Image
) )
switch d.cb { switch d.cb {
case cbG8: case cbG1, cbG2, cbG4, cbG8:
bpp = 1 bitsPerPixel = d.depth
gray = image.NewGray(d.width, d.height) gray = image.NewGray(d.width, d.height)
img = gray img = gray
case cbGA8:
bitsPerPixel = 16
nrgba = image.NewNRGBA(d.width, d.height)
img = nrgba
case cbTC8: case cbTC8:
bpp = 3 bitsPerPixel = 24
rgba = image.NewRGBA(d.width, d.height) rgba = image.NewRGBA(d.width, d.height)
img = rgba img = rgba
case cbP8: case cbP1, cbP2, cbP4, cbP8:
bpp = 1 bitsPerPixel = d.depth
paletted = image.NewPaletted(d.width, d.height, d.palette) paletted = image.NewPaletted(d.width, d.height, d.palette)
img = paletted img = paletted
maxPalette = uint8(len(d.palette) - 1) maxPalette = uint8(len(d.palette) - 1)
case cbTCA8: case cbTCA8:
bpp = 4 bitsPerPixel = 32
nrgba = image.NewNRGBA(d.width, d.height) nrgba = image.NewNRGBA(d.width, d.height)
img = nrgba img = nrgba
case cbG16: case cbG16:
bpp = 2 bitsPerPixel = 16
gray16 = image.NewGray16(d.width, d.height) gray16 = image.NewGray16(d.width, d.height)
img = gray16 img = gray16
case cbGA16:
bitsPerPixel = 32
nrgba64 = image.NewNRGBA64(d.width, d.height)
img = nrgba64
case cbTC16: case cbTC16:
bpp = 6 bitsPerPixel = 48
rgba64 = image.NewRGBA64(d.width, d.height) rgba64 = image.NewRGBA64(d.width, d.height)
img = rgba64 img = rgba64
case cbTCA16: case cbTCA16:
bpp = 8 bitsPerPixel = 64
nrgba64 = image.NewNRGBA64(d.width, d.height) nrgba64 = image.NewNRGBA64(d.width, d.height)
img = nrgba64 img = nrgba64
} }
bytesPerPixel := (bitsPerPixel + 7) / 8
// cr and pr are the bytes for the current and previous row. // cr and pr are the bytes for the current and previous row.
// The +1 is for the per-row filter type, which is at cr[0]. // The +1 is for the per-row filter type, which is at cr[0].
cr := make([]uint8, 1+bpp*d.width) cr := make([]uint8, 1+(bitsPerPixel*d.width+7)/8)
pr := make([]uint8, 1+bpp*d.width) pr := make([]uint8, 1+(bitsPerPixel*d.width+7)/8)
for y := 0; y < d.height; y++ { for y := 0; y < d.height; y++ {
// Read the decompressed bytes. // Read the decompressed bytes.
...@@ -302,26 +347,26 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) { ...@@ -302,26 +347,26 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) {
case ftNone: case ftNone:
// No-op. // No-op.
case ftSub: case ftSub:
for i := bpp; i < len(cdat); i++ { for i := bytesPerPixel; i < len(cdat); i++ {
cdat[i] += cdat[i-bpp] cdat[i] += cdat[i-bytesPerPixel]
} }
case ftUp: case ftUp:
for i := 0; i < len(cdat); i++ { for i := 0; i < len(cdat); i++ {
cdat[i] += pdat[i] cdat[i] += pdat[i]
} }
case ftAverage: case ftAverage:
for i := 0; i < bpp; i++ { for i := 0; i < bytesPerPixel; i++ {
cdat[i] += pdat[i] / 2 cdat[i] += pdat[i] / 2
} }
for i := bpp; i < len(cdat); i++ { for i := bytesPerPixel; i < len(cdat); i++ {
cdat[i] += uint8((int(cdat[i-bpp]) + int(pdat[i])) / 2) cdat[i] += uint8((int(cdat[i-bytesPerPixel]) + int(pdat[i])) / 2)
} }
case ftPaeth: case ftPaeth:
for i := 0; i < bpp; i++ { for i := 0; i < bytesPerPixel; i++ {
cdat[i] += paeth(0, pdat[i], 0) cdat[i] += paeth(0, pdat[i], 0)
} }
for i := bpp; i < len(cdat); i++ { for i := bytesPerPixel; i < len(cdat); i++ {
cdat[i] += paeth(cdat[i-bpp], pdat[i], pdat[i-bpp]) cdat[i] += paeth(cdat[i-bytesPerPixel], pdat[i], pdat[i-bytesPerPixel])
} }
default: default:
return nil, FormatError("bad filter type") return nil, FormatError("bad filter type")
...@@ -329,14 +374,79 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) { ...@@ -329,14 +374,79 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) {
// Convert from bytes to colors. // Convert from bytes to colors.
switch d.cb { switch d.cb {
case cbG1:
for x := 0; x < d.width; x += 8 {
b := cdat[x/8]
for x2 := 0; x2 < 8 && x+x2 < d.width; x2++ {
gray.Set(x+x2, y, image.GrayColor{(b >> 7) * 0xff})
b <<= 1
}
}
case cbG2:
for x := 0; x < d.width; x += 4 {
b := cdat[x/4]
for x2 := 0; x2 < 4 && x+x2 < d.width; x2++ {
gray.Set(x+x2, y, image.GrayColor{(b >> 6) * 0x55})
b <<= 2
}
}
case cbG4:
for x := 0; x < d.width; x += 2 {
b := cdat[x/2]
for x2 := 0; x2 < 2 && x+x2 < d.width; x2++ {
gray.Set(x+x2, y, image.GrayColor{(b >> 4) * 0x11})
b <<= 4
}
}
case cbG8: case cbG8:
for x := 0; x < d.width; x++ { for x := 0; x < d.width; x++ {
gray.Set(x, y, image.GrayColor{cdat[x]}) gray.Set(x, y, image.GrayColor{cdat[x]})
} }
case cbGA8:
for x := 0; x < d.width; x++ {
ycol := cdat[2*x+0]
nrgba.Set(x, y, image.NRGBAColor{ycol, ycol, ycol, cdat[2*x+1]})
}
case cbTC8: case cbTC8:
for x := 0; x < d.width; x++ { for x := 0; x < d.width; x++ {
rgba.Set(x, y, image.RGBAColor{cdat[3*x+0], cdat[3*x+1], cdat[3*x+2], 0xff}) rgba.Set(x, y, image.RGBAColor{cdat[3*x+0], cdat[3*x+1], cdat[3*x+2], 0xff})
} }
case cbP1:
for x := 0; x < d.width; x += 8 {
b := cdat[x/8]
for x2 := 0; x2 < 8 && x+x2 < d.width; x2++ {
idx := b >> 7
if idx > maxPalette {
return nil, FormatError("palette index out of range")
}
paletted.SetColorIndex(x+x2, y, idx)
b <<= 1
}
}
case cbP2:
for x := 0; x < d.width; x += 4 {
b := cdat[x/4]
for x2 := 0; x2 < 4 && x+x2 < d.width; x2++ {
idx := b >> 6
if idx > maxPalette {
return nil, FormatError("palette index out of range")
}
paletted.SetColorIndex(x+x2, y, idx)
b <<= 2
}
}
case cbP4:
for x := 0; x < d.width; x += 2 {
b := cdat[x/2]
for x2 := 0; x2 < 2 && x+x2 < d.width; x2++ {
idx := b >> 4
if idx > maxPalette {
return nil, FormatError("palette index out of range")
}
paletted.SetColorIndex(x+x2, y, idx)
b <<= 4
}
}
case cbP8: case cbP8:
for x := 0; x < d.width; x++ { for x := 0; x < d.width; x++ {
if cdat[x] > maxPalette { if cdat[x] > maxPalette {
...@@ -353,6 +463,12 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) { ...@@ -353,6 +463,12 @@ func (d *decoder) idatReader(idat io.Reader) (image.Image, os.Error) {
ycol := uint16(cdat[2*x+0])<<8 | uint16(cdat[2*x+1]) ycol := uint16(cdat[2*x+0])<<8 | uint16(cdat[2*x+1])
gray16.Set(x, y, image.Gray16Color{ycol}) gray16.Set(x, y, image.Gray16Color{ycol})
} }
case cbGA16:
for x := 0; x < d.width; x++ {
ycol := uint16(cdat[4*x+0])<<8 | uint16(cdat[4*x+1])
acol := uint16(cdat[4*x+2])<<8 | uint16(cdat[4*x+3])
nrgba64.Set(x, y, image.NRGBA64Color{ycol, ycol, ycol, acol})
}
case cbTC16: case cbTC16:
for x := 0; x < d.width; x++ { for x := 0; x < d.width; x++ {
rcol := uint16(cdat[6*x+0])<<8 | uint16(cdat[6*x+1]) rcol := uint16(cdat[6*x+0])<<8 | uint16(cdat[6*x+1])
...@@ -565,16 +681,20 @@ func DecodeConfig(r io.Reader) (image.Config, os.Error) { ...@@ -565,16 +681,20 @@ func DecodeConfig(r io.Reader) (image.Config, os.Error) {
} }
var cm image.ColorModel var cm image.ColorModel
switch d.cb { switch d.cb {
case cbG8: case cbG1, cbG2, cbG4, cbG8:
cm = image.GrayColorModel cm = image.GrayColorModel
case cbGA8:
cm = image.NRGBAColorModel
case cbTC8: case cbTC8:
cm = image.RGBAColorModel cm = image.RGBAColorModel
case cbP8: case cbP1, cbP2, cbP4, cbP8:
cm = d.palette cm = d.palette
case cbTCA8: case cbTCA8:
cm = image.NRGBAColorModel cm = image.NRGBAColorModel
case cbG16: case cbG16:
cm = image.Gray16ColorModel cm = image.Gray16ColorModel
case cbGA16:
cm = image.NRGBA64ColorModel
case cbTC16: case cbTC16:
cm = image.RGBA64ColorModel cm = image.RGBA64ColorModel
case cbTCA16: case cbTCA16:
......
...@@ -13,23 +13,23 @@ import ( ...@@ -13,23 +13,23 @@ import (
"testing" "testing"
) )
// The go PNG library currently supports only a subset of the full PNG specification.
// In particular, bit depths other than 8 or 16 are not supported, nor are grayscale-
// alpha images.
var filenames = []string{ var filenames = []string{
//"basn0g01", // bit depth is not 8 or 16 "basn0g01",
//"basn0g02", // bit depth is not 8 or 16 "basn0g01-30",
//"basn0g04", // bit depth is not 8 or 16 "basn0g02",
"basn0g02-29",
"basn0g04",
"basn0g04-31",
"basn0g08", "basn0g08",
"basn0g16", "basn0g16",
"basn2c08", "basn2c08",
"basn2c16", "basn2c16",
//"basn3p01", // bit depth is not 8 or 16 "basn3p01",
//"basn3p02", // bit depth is not 8 or 16 "basn3p02",
//"basn3p04", // bit depth is not 8 or 16 "basn3p04",
"basn3p08", "basn3p08",
//"basn4a08", // grayscale-alpha color model "basn4a08",
//"basn4a16", // grayscale-alpha color model "basn4a16",
"basn6a08", "basn6a08",
"basn6a16", "basn6a16",
} }
...@@ -58,7 +58,16 @@ func sng(w io.WriteCloser, filename string, png image.Image) { ...@@ -58,7 +58,16 @@ func sng(w io.WriteCloser, filename string, png image.Image) {
cpm, _ := cm.(image.PalettedColorModel) cpm, _ := cm.(image.PalettedColorModel)
var paletted *image.Paletted var paletted *image.Paletted
if cpm != nil { if cpm != nil {
bitdepth = 8 switch {
case len(cpm) <= 2:
bitdepth = 1
case len(cpm) <= 4:
bitdepth = 2
case len(cpm) <= 16:
bitdepth = 4
default:
bitdepth = 8
}
paletted = png.(*image.Paletted) paletted = png.(*image.Paletted)
} }
...@@ -131,8 +140,15 @@ func sng(w io.WriteCloser, filename string, png image.Image) { ...@@ -131,8 +140,15 @@ func sng(w io.WriteCloser, filename string, png image.Image) {
fmt.Fprintf(w, "%04x%04x%04x%04x ", nrgba64.R, nrgba64.G, nrgba64.B, nrgba64.A) fmt.Fprintf(w, "%04x%04x%04x%04x ", nrgba64.R, nrgba64.G, nrgba64.B, nrgba64.A)
} }
case cpm != nil: case cpm != nil:
var b, c int
for x := bounds.Min.X; x < bounds.Max.X; x++ { for x := bounds.Min.X; x < bounds.Max.X; x++ {
fmt.Fprintf(w, "%02x", paletted.ColorIndexAt(x, y)) b = b<<uint(bitdepth) | int(paletted.ColorIndexAt(x, y))
c++
if c == 8/bitdepth {
fmt.Fprintf(w, "%02x", b)
b = 0
c = 0
}
} }
} }
io.WriteString(w, "\n") io.WriteString(w, "\n")
...@@ -143,14 +159,25 @@ func sng(w io.WriteCloser, filename string, png image.Image) { ...@@ -143,14 +159,25 @@ func sng(w io.WriteCloser, filename string, png image.Image) {
func TestReader(t *testing.T) { func TestReader(t *testing.T) {
for _, fn := range filenames { for _, fn := range filenames {
// Read the .png file. // Read the .png file.
image, err := readPng("testdata/pngsuite/" + fn + ".png") img, err := readPng("testdata/pngsuite/" + fn + ".png")
if err != nil { if err != nil {
t.Error(fn, err) t.Error(fn, err)
continue continue
} }
if fn == "basn4a16" {
// basn4a16.sng is gray + alpha but sng() will produce true color + alpha
// so we just check a single random pixel.
c := img.At(2, 1).(image.NRGBA64Color)
if c.R != 0x11a7 || c.G != 0x11a7 || c.B != 0x11a7 || c.A != 0x1085 {
t.Error(fn, fmt.Errorf("wrong pixel value at (2, 1): %x", c))
}
continue
}
piper, pipew := io.Pipe() piper, pipew := io.Pipe()
pb := bufio.NewReader(piper) pb := bufio.NewReader(piper)
go sng(pipew, fn, image) go sng(pipew, fn, img)
defer piper.Close() defer piper.Close()
// Read the .sng file. // Read the .sng file.
......
...@@ -5,5 +5,14 @@ README.original gives the following license for those files: ...@@ -5,5 +5,14 @@ README.original gives the following license for those files:
Permission to use, copy, and distribute these images for any purpose Permission to use, copy, and distribute these images for any purpose
and without fee is hereby granted. and without fee is hereby granted.
The files basn0g01-30.png, basn0g02-29.png and basn0g04-31.png are in fact
not part of pngsuite but were created from files in pngsuite. Their non-power-
of-two sizes makes them useful for testing bit-depths smaller than a byte.
The *.sng files in this directory were generated from the *.png files The *.sng files in this directory were generated from the *.png files
by the sng command-line tool. by the sng command-line tool and some hand editing. The files
basn0g0{1,2,4}.sng were actually generated by first converting the PNG
to a bitdepth of 8 and then running sng on them. basn4a08.sng was generated
by from a 16-bit rgba version of basn4a08.png rather than the original
gray + alpha.
#SNG: from basn0g01-30.png
IHDR {
width: 30; height: 30; bitdepth: 8;
using grayscale;
}
gAMA {1.0000}
IMAGE {
pixels hex
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
ffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000
ffffffff0000ffffffffffff0000ffffffffffffffffffffffffff000000
ffffffff0000ffffffffffff0000ffffffffffffffffffffffff00000000
ffffffff0000ffffffffffff0000ffffffffffffffffffffff0000000000
ffffffff0000ffff0000ffff0000ffffffffffffffffffff000000000000
ffffffff0000ffff0000ffff0000ffffffffffffffffff00000000000000
ffffffff0000ffff0000ffff0000ffffffffffffffff0000000000000000
ffffffffff0000000000000000ffffffffffffffff000000000000000000
ffffffffff0000000000000000ffffffffffffff00000000000000000000
ffffffffffff0000ffff0000ffffffffffffff0000000000000000000000
ffffffffffff0000ffff0000ffffffffffff000000000000000000000000
ffffffffffffffffffffffffffffffffff00000000000000000000000000
ffffffffffffffffffffffffffffffff0000000000000000000000000000
ffffffffffffffffffffffffffffff000000000000000000000000000000
ffffffffffffffffffffffffffff00000000000000000000000000000000
ffffffffffffffffffffffffff00000000000000ffffffffffffff000000
ffffffffffffffffffffffff0000000000000000ffffffffffffff000000
ffffffffffffffffffffff000000000000000000ffff00000000ffff0000
ffffffffffffffffffff00000000000000000000ffff00000000ffff0000
ffffffffffffffffff0000000000000000000000ffffffffffffff000000
ffffffffffffffff000000000000000000000000ffffffffffffff000000
ffffffffffffff00000000000000000000000000ffff00000000ffff0000
ffffffffffff0000000000000000000000000000ffff00000000ffff0000
ffffffffff000000000000000000000000000000ffffffffffffff000000
ffffffff00000000000000000000000000000000ffffffffffffff000000
ffffff000000000000000000000000000000000000000000000000000000
ffff00000000000000000000000000000000000000000000000000000000
}
#SNG: from basn0g01.png #SNG: from basn0g01.png
IHDR { IHDR {
width: 32; height: 32; bitdepth: 1; width: 32; height: 32; bitdepth: 8;
using grayscale; using grayscale;
} }
gAMA {1.0000} gAMA {1.0000}
IMAGE { IMAGE {
pixels hex pixels hex
fffffffe ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
fffffffc ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000
fffffff8 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000
fffffff0 ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000
f3f3ffe0 ffffffff0000ffffffffffff0000ffffffffffffffffffffffffff0000000000
f3f3ffc0 ffffffff0000ffffffffffff0000ffffffffffffffffffffffff000000000000
f3f3ff80 ffffffff0000ffffffffffff0000ffffffffffffffffffffff00000000000000
f333ff00 ffffffff0000ffff0000ffff0000ffffffffffffffffffff0000000000000000
f333fe00 ffffffff0000ffff0000ffff0000ffffffffffffffffff000000000000000000
f333fc00 ffffffff0000ffff0000ffff0000ffffffffffffffff00000000000000000000
f807f800 ffffffffff0000000000000000ffffffffffffffff0000000000000000000000
f807f000 ffffffffff0000000000000000ffffffffffffff000000000000000000000000
fccfe000 ffffffffffff0000ffff0000ffffffffffffff00000000000000000000000000
fccfc000 ffffffffffff0000ffff0000ffffffffffff0000000000000000000000000000
ffff8000 ffffffffffffffffffffffffffffffffff000000000000000000000000000000
ffff0000 ffffffffffffffffffffffffffffffff00000000000000000000000000000000
fffe0000 ffffffffffffffffffffffffffffff0000000000000000000000000000000000
fffc0000 ffffffffffffffffffffffffffff000000000000000000000000000000000000
fff80fe0 ffffffffffffffffffffffffff00000000000000ffffffffffffff0000000000
fff00fe0 ffffffffffffffffffffffff0000000000000000ffffffffffffff0000000000
ffe00c30 ffffffffffffffffffffff000000000000000000ffff00000000ffff00000000
ffc00c30 ffffffffffffffffffff00000000000000000000ffff00000000ffff00000000
ff800fe0 ffffffffffffffffff0000000000000000000000ffffffffffffff0000000000
ff000fe0 ffffffffffffffff000000000000000000000000ffffffffffffff0000000000
fe000c30 ffffffffffffff00000000000000000000000000ffff00000000ffff00000000
fc000c30 ffffffffffff0000000000000000000000000000ffff00000000ffff00000000
f8000fe0 ffffffffff000000000000000000000000000000ffffffffffffff0000000000
f0000fe0 ffffffff00000000000000000000000000000000ffffffffffffff0000000000
e0000000 ffffff0000000000000000000000000000000000000000000000000000000000
c0000000 ffff000000000000000000000000000000000000000000000000000000000000
80000000 ff00000000000000000000000000000000000000000000000000000000000000
00000000 0000000000000000000000000000000000000000000000000000000000000000
} }
#SNG: from basn0g02-29.png
IHDR {
width: 29; height: 29; bitdepth: 8;
using grayscale;
}
gAMA {1.0000}
IMAGE {
pixels hex
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aa
ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aa
ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aa
ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aa
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaff
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055
ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aa
}
#SNG: from basn0g02.png #SNG: from basn0g02.png
IHDR { IHDR {
width: 32; height: 32; bitdepth: 2; width: 32; height: 32; bitdepth: 8;
using grayscale; using grayscale;
} }
gAMA {1.0000} gAMA {1.0000}
IMAGE { IMAGE {
pixels hex pixels hex
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
0055aaff0055aaff 0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
55aaff0055aaff00 55555555aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff00000000
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
aaff0055aaff0055 aaaaaaaaffffffff0000000055555555aaaaaaaaffffffff0000000055555555
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
ff0055aaff0055aa ffffffff0000000055555555aaaaaaaaffffffff0000000055555555aaaaaaaa
} }
#SNG: from basn0g04-31.png
IHDR {
width: 31; height: 31; bitdepth: 8;
using grayscale;
}
gAMA {1.0000}
IMAGE {
pixels hex
00000000111111112222222233333333444444445555555566666666777777
00000000111111112222222233333333444444445555555566666666777777
00000000111111112222222233333333444444445555555566666666777777
00000000111111112222222233333333444444445555555566666666777777
11111111222222223333333344444444555555556666666677777777888888
11111111222222223333333344444444555555556666666677777777888888
11111111222222223333333344444444555555556666666677777777888888
11111111222222223333333344444444555555556666666677777777888888
22222222333333334444444455555555666666667777777788888888999999
22222222333333334444444455555555666666667777777788888888999999
22222222333333334444444455555555666666667777777788888888999999
22222222333333334444444455555555666666667777777788888888999999
33333333444444445555555566666666777777778888888899999999aaaaaa
33333333444444445555555566666666777777778888888899999999aaaaaa
33333333444444445555555566666666777777778888888899999999aaaaaa
33333333444444445555555566666666777777778888888899999999aaaaaa
444444445555555566666666777777778888888899999999aaaaaaaabbbbbb
444444445555555566666666777777778888888899999999aaaaaaaabbbbbb
444444445555555566666666777777778888888899999999aaaaaaaabbbbbb
444444445555555566666666777777778888888899999999aaaaaaaabbbbbb
5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccc
5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccc
5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccc
5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccc
66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddd
66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddd
66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddd
66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddd
777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeee
777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeee
777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeee
}
#SNG: from basn0g04.png #SNG: from basn0g04.png
IHDR { IHDR {
width: 32; height: 32; bitdepth: 4; width: 32; height: 32; bitdepth: 8;
using grayscale; using grayscale;
} }
gAMA {1.0000} gAMA {1.0000}
IMAGE { IMAGE {
pixels hex pixels hex
00001111222233334444555566667777 0000000011111111222222223333333344444444555555556666666677777777
00001111222233334444555566667777 0000000011111111222222223333333344444444555555556666666677777777
00001111222233334444555566667777 0000000011111111222222223333333344444444555555556666666677777777
00001111222233334444555566667777 0000000011111111222222223333333344444444555555556666666677777777
11112222333344445555666677778888 1111111122222222333333334444444455555555666666667777777788888888
11112222333344445555666677778888 1111111122222222333333334444444455555555666666667777777788888888
11112222333344445555666677778888 1111111122222222333333334444444455555555666666667777777788888888
11112222333344445555666677778888 1111111122222222333333334444444455555555666666667777777788888888
22223333444455556666777788889999 2222222233333333444444445555555566666666777777778888888899999999
22223333444455556666777788889999 2222222233333333444444445555555566666666777777778888888899999999
22223333444455556666777788889999 2222222233333333444444445555555566666666777777778888888899999999
22223333444455556666777788889999 2222222233333333444444445555555566666666777777778888888899999999
3333444455556666777788889999aaaa 33333333444444445555555566666666777777778888888899999999aaaaaaaa
3333444455556666777788889999aaaa 33333333444444445555555566666666777777778888888899999999aaaaaaaa
3333444455556666777788889999aaaa 33333333444444445555555566666666777777778888888899999999aaaaaaaa
3333444455556666777788889999aaaa 33333333444444445555555566666666777777778888888899999999aaaaaaaa
444455556666777788889999aaaabbbb 444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbb
444455556666777788889999aaaabbbb 444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbb
444455556666777788889999aaaabbbb 444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbb
444455556666777788889999aaaabbbb 444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbb
55556666777788889999aaaabbbbcccc 5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccccc
55556666777788889999aaaabbbbcccc 5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccccc
55556666777788889999aaaabbbbcccc 5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccccc
55556666777788889999aaaabbbbcccc 5555555566666666777777778888888899999999aaaaaaaabbbbbbbbcccccccc
6666777788889999aaaabbbbccccdddd 66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddddd
6666777788889999aaaabbbbccccdddd 66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddddd
6666777788889999aaaabbbbccccdddd 66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddddd
6666777788889999aaaabbbbccccdddd 66666666777777778888888899999999aaaaaaaabbbbbbbbccccccccdddddddd
777788889999aaaabbbbccccddddeeee 777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee
777788889999aaaabbbbccccddddeeee 777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee
777788889999aaaabbbbccccddddeeee 777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee
777788889999aaaabbbbccccddddeeee 777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee
} }
...@@ -4,14 +4,11 @@ IHDR { ...@@ -4,14 +4,11 @@ IHDR {
using color palette; using color palette;
} }
gAMA {1.0000} gAMA {1.0000}
sBIT {
red: 1; green: 1; blue: 1;
}
PLTE { PLTE {
( 0,255, 0) # rgb = (0x00,0xff,0x00) green1 ( 0,255, 0) # rgb = (0x00,0xff,0x00)
(255, 0, 0) # rgb = (0xff,0x00,0x00) red1 (255, 0, 0) # rgb = (0xff,0x00,0x00)
(255,255, 0) # rgb = (0xff,0xff,0x00) yellow1 (255,255, 0) # rgb = (0xff,0xff,0x00)
( 0, 0,255) # rgb = (0x00,0x00,0xff) blue1 ( 0, 0,255) # rgb = (0x00,0x00,0xff)
} }
IMAGE { IMAGE {
pixels hex pixels hex
......
...@@ -4,19 +4,16 @@ IHDR { ...@@ -4,19 +4,16 @@ IHDR {
using color palette; using color palette;
} }
gAMA {1.0000} gAMA {1.0000}
sBIT {
red: 4; green: 4; blue: 4;
}
PLTE { PLTE {
( 34, 0,255) # rgb = (0x22,0x00,0xff) ( 34, 0,255) # rgb = (0x22,0x00,0xff)
( 0,255,255) # rgb = (0x00,0xff,0xff) cyan1 ( 0,255,255) # rgb = (0x00,0xff,0xff)
(136, 0,255) # rgb = (0x88,0x00,0xff) (136, 0,255) # rgb = (0x88,0x00,0xff)
( 34,255, 0) # rgb = (0x22,0xff,0x00) ( 34,255, 0) # rgb = (0x22,0xff,0x00)
( 0,153,255) # rgb = (0x00,0x99,0xff) ( 0,153,255) # rgb = (0x00,0x99,0xff)
(255,102, 0) # rgb = (0xff,0x66,0x00) (255,102, 0) # rgb = (0xff,0x66,0x00)
(221, 0,255) # rgb = (0xdd,0x00,0xff) (221, 0,255) # rgb = (0xdd,0x00,0xff)
(119,255, 0) # rgb = (0x77,0xff,0x00) (119,255, 0) # rgb = (0x77,0xff,0x00)
(255, 0, 0) # rgb = (0xff,0x00,0x00) red1 (255, 0, 0) # rgb = (0xff,0x00,0x00)
( 0,255,153) # rgb = (0x00,0xff,0x99) ( 0,255,153) # rgb = (0x00,0xff,0x99)
(221,255, 0) # rgb = (0xdd,0xff,0x00) (221,255, 0) # rgb = (0xdd,0xff,0x00)
(255, 0,187) # rgb = (0xff,0x00,0xbb) (255, 0,187) # rgb = (0xff,0x00,0xbb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment