Nigel, I added the sRGB, cHRM, and gAMA chunks, extended the Encoder
structure, and use it like this in my own code:

case ".jpg":
err = jpeg.Encode(file, p, &jpeg.Options{
Quality: 95,
})
if err != nil {
log.Fatal(err)
}
case ".png":
// err = png.Encode(file, p) // colorspace and gamma unspecified
err = (&png.Encoder{IsSRGB: true, RenderingIntent:
png.Perceptual}).Encode(file, p)
if err != nil {
log.Fatal(err)
}
case ".tiff":
// err = tiff.Encode(file, p, nil) // uncompressed
err = tiff.Encode(file, p, &tiff.Options{
Compression: tiff.Deflate,
Predictor:   true,
})
if err != nil {
log.Fatal(err)
}

I updated https://github.com/golang/go/issues/20613 about the details.

On Thu, Sep 28, 2017 at 7:38 AM, Michael Jones <michael.jo...@gmail.com>
wrote:

> thanks, i'll make notes there
>
> On Wed, Sep 27, 2017 at 11:01 PM, Nigel Tao <nigel...@golang.org> wrote:
>
>> On Thu, Sep 28, 2017 at 10:28 AM, Michael Jones <michael.jo...@gmail.com>
>> wrote:
>> > Not quite related, but if changes are going to happen, I want to add
>> (or see
>> > someone add) colorspace tags to the PNG code and the TIFF code.
>>
>> It's not exactly what you're asking for, but there are already issues
>> https://github.com/golang/go/issues/11420 "x/image/draw: color
>> space-correct interpolation" and
>> https://github.com/golang/go/issues/20613 "image/png: don't ignore PNG
>> gAMA chunk". There might be other issues filed, I didn't do an
>> exhaustive search.
>>
>
>
>
> --
> Michael T. Jones
> michael.jo...@gmail.com
>



-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to