func (im *Image) ParseReader(rd io.Reader) error {
	if img, _, err := image.Decode(rd); err != nil {
		return err
	} else {
		im.im = img
	}
	im.width = im.im.Bounds().Dx()
	im.height = im.im.Bounds().Dy()
	if im.width < im.cols {
		im.cols = im.width
	}
	im.ratio = float64(im.width) / float64(im.cols)
	im.rows = int(float64(im.height) / im.ratio)
	return nil
}
ParseReader reads image data from the reader.
package aimg
import (
	"bytes"
	"image"
	"io"
	"os"
	"strings"
	_ "image/gif"
	_ "image/jpeg"
	_ "image/png"
	"github.com/stroborobo/aimg/terminal"
	"github.com/stroborobo/ansirgb"
)
var (
	isUTF8 = false
)
func init() {
	isUTF8 = strings.Contains(os.Getenv("LC_ALL"), "UTF-8") ||
		strings.Contains(os.Getenv("LANG"), "UTF-8")
}
type Image struct {
	im image.Image
	width  int
	height int
	cols int
	rows int
	ratio float64
	readIndex int
}
func NewImage(cols int) *Image {
	return &Image{
		cols: cols,
	}
}
func (im *Image) Size() (rows, cols int) {
	return im.cols, im.rows / 2
}
func (im *Image) ActualSize() (height, width int) {
	return im.width, im.height
}
func (im *Image) ParseFile(fpath string) error {
	fh, err := os.Open(fpath)
	if err != nil {
		return err
	}
	defer fh.Close()
	return im.ParseReader(fh)
}