func (cs *ChunkSlice) FindExif() (chunk *Chunk, err error) {
	defer func() {
		if state := recover(); state != nil {
			err = log.Wrap(state.(error))
		}
	}()
	index := cs.Index()
	if chunks, found := index[EXifChunkType]; found == true {
		return chunks[0], nil
	}
	log.Panic(exif.ErrNoExif)
	return nil, nil
}
FindExif returns the the segment that hosts the EXIF data.
package pngstructure
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"encoding/binary"
	"hash/crc32"
	"github.com/dsoprea/go-exif/v3"
	"github.com/dsoprea/go-exif/v3/common"
	"github.com/dsoprea/go-logging"
	"github.com/dsoprea/go-utility/v2/image"
)
var (
	PngSignature  = [8]byte{137, 'P', 'N', 'G', '\r', '\n', 26, '\n'}
	EXifChunkType = "eXIf"
	IHDRChunkType = "IHDR"
)
var (
	ErrNotPng     = errors.New("not png data")
	ErrCrcFailure = errors.New("crc failure")
)
type ChunkSlice struct {
	chunks []*Chunk
}
func NewChunkSlice(chunks []*Chunk) *ChunkSlice {
	if len(chunks) == 0 {
		log.Panicf("ChunkSlice must be initialized with at least one chunk (IHDR)")
	} else if chunks[0].Type != IHDRChunkType {
		log.Panicf("first chunk in any ChunkSlice must be an IHDR")
	}
	return &ChunkSlice{
		chunks: chunks,
	}
}
func NewPngChunkSlice() *ChunkSlice {
	ihdrChunk := &Chunk{
		Type: IHDRChunkType,
	}
	ihdrChunk.UpdateCrc32()
	return NewChunkSlice([]*Chunk{ihdrChunk})
}
func (cs *ChunkSlice) String() string {
	return fmt.Sprintf("ChunkSlize<LEN=(%d)>", len(cs.chunks))
}
func (cs *ChunkSlice) Chunks() []*Chunk {
	return cs.chunks
}
func (cs *ChunkSlice) WriteTo(w io.Writer) (err error) {
	defer func() {
		if state := recover(); state != nil {
			err = log.Wrap(state.(error))
		}
	}()
	_, err = w.Write(PngSignature[:])
	log.PanicIf(err)
	for _, c := range cs.chunks {
		_, err := c.WriteTo(w)
		log.PanicIf(err)
	}
	return nil
}
func (cs *ChunkSlice) Index() (index map[string][]*Chunk) {
	index = make(map[string][]*Chunk)
	for _, c := range cs.chunks {
		if grouped, found := index[c.Type]; found == true {
			index[c.Type] = append(grouped, c)
		} else {
			index[c.Type] = []*Chunk{c}
		}
	}
	return index
}