Documentation
¶
Index ¶
- Variables
- func Decode(r io.Reader, o *DecodeOptions) (image.Image, error)
- func Encode(name string, w io.Writer, i image.Image, o *EncodeOptions) error
- func RegisterCodec(c Codec)
- type BMPCodec
- func (c *BMPCodec) Aliases() []string
- func (c *BMPCodec) Decode(r io.Reader, d *DecodeOptions) (image.Image, error)
- func (c *BMPCodec) DecodeConfig(r io.Reader, d *DecodeOptions) (image.Config, error)
- func (c *BMPCodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
- func (c *BMPCodec) Magic() []string
- func (c *BMPCodec) Name() string
- func (c *BMPCodec) New() Codec
- type Codec
- type CodecWithAliases
- type CodecWithParamParser
- type DecodeOptions
- type Decoder
- type EncodeOptions
- type Encoder
- type ErrNoSuchCodec
- type GIFCodec
- func (c *GIFCodec) Decode(r io.Reader, d *DecodeOptions) (image.Image, error)
- func (c *GIFCodec) DecodeConfig(r io.Reader, d *DecodeOptions) (image.Config, error)
- func (c *GIFCodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
- func (c *GIFCodec) Magic() []string
- func (c *GIFCodec) Name() string
- func (c *GIFCodec) New() Codec
- type JPEGCodec
- func (c *JPEGCodec) Aliases() []string
- func (c *JPEGCodec) Decode(r io.Reader, d *DecodeOptions) (image.Image, error)
- func (c *JPEGCodec) DecodeConfig(r io.Reader, d *DecodeOptions) (image.Config, error)
- func (c *JPEGCodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
- func (c *JPEGCodec) Magic() []string
- func (c *JPEGCodec) Name() string
- func (c *JPEGCodec) New() Codec
- type Metadata
- type NetPBMCodec
- func (c *NetPBMCodec) Decode(r io.Reader, d *DecodeOptions) (image.Image, error)
- func (c *NetPBMCodec) DecodeConfig(r io.Reader, d *DecodeOptions) (image.Config, error)
- func (c *NetPBMCodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
- func (c *NetPBMCodec) Magic() []string
- func (c *NetPBMCodec) Name() string
- func (c *NetPBMCodec) New() Codec
- type PNGCodec
- func (c *PNGCodec) Decode(r io.Reader, o *DecodeOptions) (image.Image, error)
- func (c *PNGCodec) DecodeConfig(r io.Reader, o *DecodeOptions) (image.Config, error)
- func (c *PNGCodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
- func (c *PNGCodec) Magic() []string
- func (c *PNGCodec) Name() string
- func (c *PNGCodec) New() Codec
- type QOICodec
- func (c *QOICodec) Decode(r io.Reader, d *DecodeOptions) (image.Image, error)
- func (c *QOICodec) DecodeConfig(r io.Reader, d *DecodeOptions) (image.Config, error)
- func (c *QOICodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
- func (c *QOICodec) Magic() []string
- func (c *QOICodec) Name() string
- func (c *QOICodec) New() Codec
- type ResizeStrategy
- type TIFFCodec
- func (c *TIFFCodec) Aliases() []string
- func (c *TIFFCodec) Decode(r io.Reader, d *DecodeOptions) (image.Image, error)
- func (c *TIFFCodec) DecodeConfig(r io.Reader, d *DecodeOptions) (image.Config, error)
- func (c *TIFFCodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
- func (c *TIFFCodec) Magic() []string
- func (c *TIFFCodec) Name() string
- func (c *TIFFCodec) New() Codec
- type TextData
- func (td *TextData) Add(te *TextEntry)
- func (td *TextData) AddString(key, value string)
- func (td TextData) Get(key string) (value *TextEntry, ok bool)
- func (td TextData) GetString(key string) (value string, ok bool)
- func (td *TextData) Set(te *TextEntry) (replaced bool)
- func (td *TextData) SetString(key, value string) (replaced bool)
- func (td TextData) ToStringMap() (ret map[string]string)
- type TextEntry
- type WEBPCodec
- type Wand
- func (w *Wand) AddComment(comment string)
- func (w *Wand) Clone() *Wand
- func (w *Wand) Comments() []string
- func (w *Wand) Crop(iw, ih, xoff, yoff int)
- func (w *Wand) CropAnchor(iw, ih int, anchor string)
- func (w *Wand) DecodeImage(r io.Reader) error
- func (w *Wand) EncodeImage(wr io.Writer, codec string) error
- func (w *Wand) ForceRGBA()
- func (w *Wand) FormatString(fmt string) (ret string)
- func (w *Wand) Hash() uint64
- func (w *Wand) Height() int
- func (w *Wand) Image() image.Image
- func (w *Wand) Metadata() *Metadata
- func (w *Wand) NewImage(iw, ih int)
- func (w *Wand) ReadImage(path string) error
- func (w *Wand) Resize(iw, ih int, strategy ResizeStrategy)
- func (w *Wand) ResizeArea(area int, strategy ResizeStrategy)
- func (w *Wand) SetComments(comments []string)
- func (w *Wand) SetCompressionLevel(l int)
- func (w *Wand) SetCompressionQuality(q int)
- func (w *Wand) SetImage(im image.Image)
- func (w *Wand) Strip()
- func (w *Wand) Width() int
- func (w *Wand) WriteImage(path string) error
Constants ¶
This section is empty.
Variables ¶
var ( BiLinearStrategy = draw.BiLinear NearestStrategy = draw.NearestNeighbor )
Functions ¶
func Decode ¶
Decode decodes an image that has been encoded in a format understood by a registered codec.
func Encode ¶
Encode encodes an image into the registered codec corresponding to the specified name.
func RegisterCodec ¶
func RegisterCodec(c Codec)
RegisterCodec registers a new image processing codec.
Types ¶
type BMPCodec ¶
type BMPCodec struct{}
BMPCodec is the BMP codec.
func (*BMPCodec) DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a BMP image without decoding the image.
type CodecWithAliases ¶
CodecWithAliases is an image codec that can have alternate names. Use this if you want to support format autodetection for multiple file extensions.
type CodecWithParamParser ¶
CodecWithParamParser is an image codec that allows getting codec-specific parameters from a string.
type DecodeOptions ¶
type DecodeOptions struct { // Metadata is any metadata or additional properties associated // with the image. Set this to an empty metadata struct in order // to read this data. Metadata *Metadata // Strict tells the decoder whether or not to strictly parse even // non-critical metadata. Strict bool // DecoderSpecific is decoder-specific options. DecoderSpecific any }
DecodeOptions specifies options for image decoders.
func DefaultDecodeOptions ¶
func DefaultDecodeOptions() *DecodeOptions
DefaultDecodeOptions returns the default decoding options.
type Decoder ¶
type Decoder interface { Codec Magic() []string Decode(io.Reader, *DecodeOptions) (image.Image, error) DecodeConfig(io.Reader, *DecodeOptions) (image.Config, error) }
Decoder is an image codec that can decode.
type EncodeOptions ¶
type EncodeOptions struct { // CompressionLevel is the compression level to use, on a scale // of 0 to 100. A value of 0 indicates no compression for PNG, // and 100% quality for JPEG. Other codecs may interpret this // value differently. CompressionLevel int // Metadata is any metadata or additional properties associated // with the image. Metadata *Metadata // EncoderSpecific is encoder-specific options. EncoderSpecific any }
EncodeOptions specifies options for image encoders.
func DefaultEncodeOptions ¶
func DefaultEncodeOptions() *EncodeOptions
DefaultEncodeOptions returns the default encoding options.
type ErrNoSuchCodec ¶
type ErrNoSuchCodec string
func (ErrNoSuchCodec) Error ¶
func (e ErrNoSuchCodec) Error() string
type GIFCodec ¶
type GIFCodec struct{}
GIFCodec is the GIF codec.
func (*GIFCodec) DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a GIF image without decoding the image.
type JPEGCodec ¶
type JPEGCodec struct{}
JPEGCodec is the JPEG codec.
func (*JPEGCodec) DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a JPEG image without decoding the image.
type Metadata ¶
type Metadata struct { // Text contains key-value pairs of text data. Text TextData // Comments contains a list of comments for the image. Comments []string // Specific contains encoder/decoder specific data. Specific any }
Metadata is additional image metadata.
type NetPBMCodec ¶
NetPBMCodec is the NetPBM codec.
func (*NetPBMCodec) Decode ¶
func (c *NetPBMCodec) Decode(r io.Reader, d *DecodeOptions) (image.Image, error)
Decode decodes a NetPBM image according to the options specified.
func (*NetPBMCodec) DecodeConfig ¶
func (c *NetPBMCodec) DecodeConfig(r io.Reader, d *DecodeOptions) (image.Config, error)
DecodeConfig returns the color model and dimensions of a NetPBM image without decoding the image.
func (*NetPBMCodec) Encode ¶
func (c *NetPBMCodec) Encode(w io.Writer, i image.Image, o *EncodeOptions) error
Encode encodes a NetPBM image according to the options specified.
func (*NetPBMCodec) Magic ¶
func (c *NetPBMCodec) Magic() []string
Magic returns magic strings that identify NetPBM data.
func (*NetPBMCodec) Name ¶
func (c *NetPBMCodec) Name() string
Name returns the name of the NetPBM codec: "netpbm"
func (*NetPBMCodec) New ¶
func (c *NetPBMCodec) New() Codec
New returns a new instance of NetPBMCodec.
type PNGCodec ¶
type PNGCodec struct {
// contains filtered or unexported fields
}
PNGCodec is the still PNG codec.
func (*PNGCodec) DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a PNG image without decoding the image.
type QOICodec ¶
type QOICodec struct{}
QOICodec is the QOI codec.
func (*QOICodec) DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a QOI image without decoding the image.
type ResizeStrategy ¶
type ResizeStrategy = draw.Interpolator
ResizeStrategy is an interpolation strategy for resizing images.
type TIFFCodec ¶
type TIFFCodec struct{}
TIFFCodec is the TIFF codec.
func (*TIFFCodec) DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a TIFF image without decoding the image.
type TextData ¶
type TextData []*TextEntry
func NewTextData ¶
func NewTextData() TextData
func (TextData) ToStringMap ¶
type WEBPCodec ¶
type WEBPCodec struct{}
WEBPCodec is the WEBP codec.
func (*WEBPCodec) DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a WEBP image without decoding the image.
type Wand ¶
type Wand struct {
// contains filtered or unexported fields
}
func (*Wand) AddComment ¶
func (*Wand) CropAnchor ¶
func (*Wand) FormatString ¶
func (*Wand) Resize ¶
func (w *Wand) Resize(iw, ih int, strategy ResizeStrategy)
func (*Wand) ResizeArea ¶
func (w *Wand) ResizeArea(area int, strategy ResizeStrategy)