Add test/data/red-blue-gradient.dcip3d65.png

This commit is contained in:
Nigel Tao committed 2021-10-15 11:29:26 +11:00
1 parent ad1d983698
commit e6733aec19
6 files changed
+24 -2

No files matched your search

+19 -2
View File
@@ -24,6 +24,7 @@ package main
import (
"bytes"
"compress/zlib"
"flag"
"hash/crc32"
"image"
@@ -34,7 +35,8 @@ import (
)
var (
gama = flag.Float64("gama", 2.2, "Gamma correction value (e.g. 2.2)")
gama = flag.Float64("gama", 0, "Gamma correction value (e.g. 2.2)")
iccp = flag.String("iccp", "", "ICC filename (e.g. foo/bar.icc)")
)
func main() {
@@ -71,7 +73,8 @@ func main1() error {
out := []byte(nil)
out = append(out, prefix...)
// Insert the optional gAMA chunk between the prefix and suffix.
// Insert the optional chunks between the prefix and suffix.
if *gama > 0 {
g := uint32(math.Round(100000 / *gama))
out = appendPNGChunk(out, "gAMA",
@@ -82,6 +85,20 @@ func main1() error {
)
}
if *iccp != "" {
raw, err := os.ReadFile(*iccp)
if err != nil {
return err
}
data := &bytes.Buffer{}
data.WriteString("icc\x00") // An arbitrary NUL terminated name.
data.WriteByte(0x00) // 0x00 means zlib compression.
w := zlib.NewWriter(data)
w.Write(raw)
w.Close()
out = appendPNGChunk(out, "iCCP", data.Bytes()...)
}
// Append the suffix and write to stdout.
out = append(out, suffix...)
_, err := os.Stdout.Write(out)
Binary file not shown.
Binary file not shown.
+5
View File
@@ -29,6 +29,11 @@ The non-ascii directory holds trivial UTF-8 (but not ASCII) text files.
---
`DCI-P3-D65.icc` comes from
[color.org](https://www.color.org/chardata/rgb/DCIP3.xalter).
`DCI-P3-D65.icc.zlib` is a zlib-compresion of that, created by Go's standard
library.
`archive.*` archives a subset of other files in this directory.
`animated-red-blue.gif` is an original animation by Nigel Tao
Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B