Merge pull request #83 from Xeoncross/master
Add support for JPEG encoding
This commit is contained in:
commit
4dc34561c6
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"io"
|
||||
"math"
|
||||
@ -150,6 +151,13 @@ func (dc *Context) EncodePNG(w io.Writer) error {
|
||||
return png.Encode(w, dc.im)
|
||||
}
|
||||
|
||||
// EncodeJPG encodes the image as a JPG and writes it to the provided io.Writer
|
||||
// in JPEG 4:2:0 baseline format with the given options.
|
||||
// Default parameters are used if a nil *jpeg.Options is passed.
|
||||
func (dc *Context) EncodeJPG(w io.Writer, o *jpeg.Options) error {
|
||||
return jpeg.Encode(w, dc.im, o)
|
||||
}
|
||||
|
||||
// SetDash sets the current dash pattern to use. Call with zero arguments to
|
||||
// disable dashes. The values specify the lengths of each dash, with
|
||||
// alternating on and off lengths.
|
||||
|
Loading…
Reference in New Issue
Block a user