func (p *PngData) Write(f *os.File) error {
	_, err := f.Write(p.header)
	if err != nil {
		return err
	}
	err = p.writeChunks(f)
	return err
}
writes all the data of the png into a new file
package main
import (
	"encoding/binary"
	"errors"
	"hash/crc32"
	"io"
	"os"
)
type ChunkData struct {
	length uint32
	name string
	data []byte
	crc uint32
}
func (c *ChunkData) GetRaw() []byte {
	var raw []byte
	lengthRaw := make([]byte, 4)
	crcRaw := make([]byte, 4)
	binary.BigEndian.PutUint32(lengthRaw, c.length)
	binary.BigEndian.PutUint32(crcRaw, c.crc)
	nameRaw := []byte(c.name)
	raw = append(raw, lengthRaw...)
	raw = append(raw, nameRaw...)
	raw = append(raw, c.data...)
	raw = append(raw, crcRaw...)
	return raw
}
func (c *ChunkData) Verify() bool {
	var data []byte
	data = append(data, []byte(c.name)...)
	data = append(data, c.data...)
	crc := crc32.ChecksumIEEE(data)
	return c.crc == crc
}
type PngData struct {
	header []byte
	chunks []ChunkData
}
func (p *PngData) Read(f *os.File) error {
	valid, header := ValidatePng(f)
	if valid {
		p.header = header
		err := p.readChunks(f)
		if err != io.EOF {
			return err
		}
	} else {
		return errors.New("invalid png")
	}
	return nil
}