mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 16:52:18 +01:00
Add test/data/red-blue-gradient.dcip3d65.png
This commit is contained in:
1 parent
ad1d983698
commit
e6733aec19
6 files changed
+24
-2
No files matched your search
@@ -24,6 +24,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"compress/zlib"
|
||||||
"flag"
|
"flag"
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
"image"
|
"image"
|
||||||
@@ -34,7 +35,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
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() {
|
func main() {
|
||||||
@@ -71,7 +73,8 @@ func main1() error {
|
|||||||
out := []byte(nil)
|
out := []byte(nil)
|
||||||
out = append(out, prefix...)
|
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 {
|
if *gama > 0 {
|
||||||
g := uint32(math.Round(100000 / *gama))
|
g := uint32(math.Round(100000 / *gama))
|
||||||
out = appendPNGChunk(out, "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.
|
// Append the suffix and write to stdout.
|
||||||
out = append(out, suffix...)
|
out = append(out, suffix...)
|
||||||
_, err := os.Stdout.Write(out)
|
_, err := os.Stdout.Write(out)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -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.
|
`archive.*` archives a subset of other files in this directory.
|
||||||
|
|
||||||
`animated-red-blue.gif` is an original animation by Nigel Tao
|
`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 |
Reference in new issue
Block a user