internal/png/stdlibwriter.go
func (e *encoder) Write(b []byte) (int, error) {
	e.writeChunk(b, "IDAT")
	if e.err != nil {
		return 0, e.err
	}
	return len(b), nil
}
func (e *encoder) Write(b []byte) (int, error) {
	e.writeChunk(b, "IDAT")
	if e.err != nil {
		return 0, e.err
	}
	return len(b), nil
}
func ( e * encoder ) Write ( b [ ] byte ) ( int , error ) { e . writeChunk ( b , " " ) if e . err != nil { return 0 , e . err } return len ( b ) , nil }
// An encoder is an io.Writer that satisfies writes by writing PNG IDAT chunks,
// including an 8-byte header and 4-byte CRC checksum per Write call. Such calls
// should be relatively infrequent, since writeIDATs uses a bufio.Writer.
//
// This method should only be called from writeIDATs (via writeImage).
// No other code should treat an encoder as an io.Writer.
An encoder is an io . Writer that satisfies writes by writing PNG IDAT chunks including an 8 - byte header and 4 - byte CRC checksum per Write call . Such calls should be relatively infrequent since writeIDATs uses a bufio . Writer . This method should only be called from writeIDATs ( via writeImage ) . No other code should treat an encoder as an io . Writer .