Documentation ¶
Overview ¶
Package decode provides methods for decoding images.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeFromPath ¶
func RegisterDecoder ¶
func RegisterDecoder(ctx context.Context, f InitializeDecoderFunc, schemes ...string) error
RegisterDecoder registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `Decoder` instances by the `NewDecoder` method.
Types ¶
type Decoder ¶
type Decoder interface { // Decode decodes an `io.ReaderSeeker` instance and returns an `image.Image` instance. Decode(context.Context, io.ReadSeeker) (image.Image, string, error) }
func NewDecoder ¶
NewDecoder returns a new `Decoder` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `DecoderInitializationFunc` function used to instantiate the new `Decoder`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterDecoder` method.
func NewGIFDecoder ¶
NewGIFDecoder returns a new `GIFDecoder` instance. 'uri' in the form of:
/path/to/image.gif
func NewJPEGDecoder ¶
NewJPEGDecoder returns a new `JPEGDecoder` instance. 'uri' in the form of:
/path/to/image.jpg
type GIFDecoder ¶
type GIFDecoder struct {
Decoder
}
GIFDecoder is a struct that implements the `Decoder` interface for decoding GIF image.
type InitializeDecoderFunc ¶
DecoderInitializationFunc is a function defined by individual decoder package and used to create an instance of that decoder.
type JPEGDecoder ¶
type JPEGDecoder struct {
Decoder
}
JPEGDecoder is a struct that implements the `Decoder` interface for decoding JPEG image.
type PNGDecoder ¶
type PNGDecoder struct {
Decoder
}
PNGDecoder is a struct that implements the `Decoder` interface for decoding PNG image.