Documentation
¶
Index ¶
- Constants
- func DecodeConfig(path string) (image.Config, error)
- func Ext(name string) (string, bool)
- func HasChildren(tag string) bool
- func HasExt(name string) bool
- func IsValidFormat(name string) bool
- func OpenAll(files []string) ([]image.Image, error)
- func Save(output string, base image.Image, opts ...EncodeOption) error
- func SaveAll(output string, images []image.Image, opts ...EncodeOption) error
- func SplitFunc(c rune) bool
- func SplitTags(tag string) []string
- type DecodeOption
- type Decoder
- type EncodeOption
- func BackgroundColor(color color.Color) EncodeOption
- func Base64(outFmt Format) EncodeOption
- func GIFBackgroundIndex(d byte) EncodeOption
- func GIFDelay(d int) EncodeOption
- func GIFDelays(d []int) EncodeOption
- func GIFDisposal(d []byte) EncodeOption
- func GIFDrawer(drawer draw.Drawer) EncodeOption
- func GIFLoopCount(d int) EncodeOption
- func GIFNumColors(numColors int) EncodeOption
- func GIFQuantizer(quantizer draw.Quantizer) EncodeOption
- func PDFPages(pages []image.Image) EncodeOption
- func PNGCompressionLevel(level png.CompressionLevel) EncodeOption
- func Padding(padding string) EncodeOption
- func Quality(quality int) EncodeOption
- func TIFFCompressionType(compressionType TIFFCompression) EncodeOption
- func WEBPAnimationBackgroundColor(color uint32) EncodeOption
- func WEBPAnimationDisposal(disposal int) EncodeOption
- func WEBPAnimationDisposals(disposals []int) EncodeOption
- func WEBPAnimationDuration(dur int) EncodeOption
- func WEBPAnimationDurations(dur []int) EncodeOption
- func WEBPAnimationFrames(frames []image.Image) EncodeOption
- func WEBPAnimationLoopCount(loops int) EncodeOption
- func WEBPUseExtendedFormat(b bool) EncodeOption
- type Encoder
- func (enc *Encoder) AnimateImages(output string, images []image.Image) error
- func (enc *Encoder) AnimatedGIF(output string, images []string) error
- func (enc *Encoder) AnimatedWEBP(output string, images []string) error
- func (enc *Encoder) Encode(w io.Writer, img image.Image) error
- func (enc *Encoder) Save(output string, base image.Image) error
- func (enc *Encoder) SaveAll(output string, images []image.Image) error
- type ExifField
- type Format
- func (f Format) Decode(r io.Reader) (image.Image, error)
- func (f Format) DecodeAnimatedWebP(r io.Reader) (*webp.WEBP, error)
- func (f Format) DecodeConfig(r io.Reader) (image.Config, error)
- func (f Format) Encode(w io.Writer, img image.Image, opts ...EncodeOption) error
- func (f Format) ImageType() imagetype.ImageType
- func (f Format) MarshalText() ([]byte, error)
- func (f Format) MimeType() string
- func (f Format) Save(output string, img image.Image, opts ...EncodeOption) error
- func (f Format) SaveAll(output string, imgs []image.Image, opts ...EncodeOption) error
- func (f Format) String() (format string)
- func (f *Format) UnmarshalText(text []byte) error
- type Img
- type TIFFCompression
- type Tag
- type Tags
Constants ¶
const (
Separator = ` > `
)
Variables ¶
This section is empty.
Functions ¶
func HasChildren ¶
func IsValidFormat ¶
func Save ¶
func Save(output string, base image.Image, opts ...EncodeOption) error
Save saves image according to the encoder https://github.com/sunshineplan/imgconv
func SaveAll ¶
func SaveAll(output string, images []image.Image, opts ...EncodeOption) error
SaveAll saves images according to the encoder https://github.com/sunshineplan/imgconv
Types ¶
type Decoder ¶
type Decoder struct {
Fmt Format
// contains filtered or unexported fields
}
func NewDecoder ¶
type EncodeOption ¶
type EncodeOption func(*Encoder)
EncodeOption sets an optional parameter for the Encode and Save functions. https://github.com/disintegration/imaging
func BackgroundColor ¶
func BackgroundColor(color color.Color) EncodeOption
BackgroundColor returns an EncodeOption that sets the background color.
func Base64 ¶
func Base64(outFmt Format) EncodeOption
Base64 returns an EncodeOption that encodes the format to Base64.
func GIFBackgroundIndex ¶
func GIFBackgroundIndex(d byte) EncodeOption
GIFBackgroundIndex returns an EncodeOption that sets the delay for gif frames.
func GIFDelay ¶
func GIFDelay(d int) EncodeOption
GIFDelay returns an EncodeOption that sets the delay for gif frames. This is a convenience function to set the same delay for all frames.
func GIFDelays ¶
func GIFDelays(d []int) EncodeOption
GIFDelays returns an EncodeOption that sets the delay for gif frames.
func GIFDisposal ¶
func GIFDisposal(d []byte) EncodeOption
GIFDisposal returns an EncodeOption that sets the delay for gif frames.
func GIFDrawer ¶
func GIFDrawer(drawer draw.Drawer) EncodeOption
GIFDrawer returns an EncodeOption that sets the drawer that is used to convert the source image to the desired palette of the GIF-encoded image.
func GIFLoopCount ¶
func GIFLoopCount(d int) EncodeOption
GIFLoopCount returns an EncodeOption that sets the delay for gif frames.
func GIFNumColors ¶
func GIFNumColors(numColors int) EncodeOption
GIFNumColors returns an EncodeOption that sets the maximum number of colors used in the GIF-encoded image. It ranges from 1 to 256. Default is 256.
func GIFQuantizer ¶
func GIFQuantizer(quantizer draw.Quantizer) EncodeOption
GIFQuantizer returns an EncodeOption that sets the quantizer that is used to produce a palette of the GIF-encoded image.
func PDFPages ¶
func PDFPages(pages []image.Image) EncodeOption
PDFPages returns an EncodeOption that sets multiple pages for pdf conversion.
func PNGCompressionLevel ¶
func PNGCompressionLevel(level png.CompressionLevel) EncodeOption
PNGCompressionLevel returns an EncodeOption that sets the compression level of the PNG-encoded image. Default is png.DefaultCompression.
func Padding ¶
func Padding(padding string) EncodeOption
Padding returns an EncodeOption that writes a batch of images. Arguments are a list of images and a fmt string for zero padding: eg, %04d.
func Quality ¶
func Quality(quality int) EncodeOption
Quality returns an EncodeOption that sets the output JPEG or PDF quality. Quality ranges from 1 to 100 inclusive, higher is better.
func TIFFCompressionType ¶
func TIFFCompressionType(compressionType TIFFCompression) EncodeOption
TIFFCompressionType returns an EncodeOption that sets the compression type of the TIFF-encoded image. Default is tiff.Deflate.
func WEBPAnimationBackgroundColor ¶
func WEBPAnimationBackgroundColor(color uint32) EncodeOption
WEBPAnimationBackgroundColor returns an EncodeOption that sets the webp animation durations. Canvas background color in BGRA order, used for clear operations.
func WEBPAnimationDisposal ¶
func WEBPAnimationDisposal(disposal int) EncodeOption
WEBPAnimationDisposal returns an EncodeOption that sets the webp animation durations.
func WEBPAnimationDisposals ¶
func WEBPAnimationDisposals(disposals []int) EncodeOption
WEBPAnimationDisposals returns an EncodeOption that sets the webp animation durations.
func WEBPAnimationDuration ¶
func WEBPAnimationDuration(dur int) EncodeOption
WEBPAnimationDurations returns an EncodeOption that sets the webp animation durations.
func WEBPAnimationDurations ¶
func WEBPAnimationDurations(dur []int) EncodeOption
WEBPAnimationDurations returns an EncodeOption that sets the webp animation durations.
func WEBPAnimationFrames ¶
func WEBPAnimationFrames(frames []image.Image) EncodeOption
WEBPAnimationFrames returns an EncodeOption that sets the webp animation frames.
func WEBPAnimationLoopCount ¶
func WEBPAnimationLoopCount(loops int) EncodeOption
WEBPAnimationLoopCount returns an EncodeOption that sets the webp animation durations.
func WEBPUseExtendedFormat ¶
func WEBPUseExtendedFormat(b bool) EncodeOption
WEBPUseExtendedFormat returns EncodeOption that determines whether to use extended format of the WEBP-encoded image. Default is false.
type Encoder ¶
type Encoder struct {
Format Format
EncodeOption []EncodeOption
Quality int
// contains filtered or unexported fields
}
Encoder is format option
func NewEncoder ¶
func NewEncoder(format Format, opts ...EncodeOption) *Encoder
NewEncoder initializes an encoder.
func (*Encoder) AnimateImages ¶
AnimateImages creates an animated WEBP according to the encoder
func (*Encoder) AnimatedWEBP ¶
Animate creates an animated WEBP according to the encoder
func (*Encoder) Encode ¶
Encode writes the image img to w in the specified format (JPEG, PNG, GIF, TIFF, BMP, PDF, WEBP, HTML, or BASE64).
func (*Encoder) Save ¶
Save saves image according to the encoder https://github.com/sunshineplan/imgconv
type ExifField ¶
type ExifField int
const ( // title fields Title ExifField = iota Caption // creator fields Source Byline Credit Rights Copyright // caption fields UserComment Description Notes ImageDescription // tag fields CatalogSets HierarchicalSubject LastKeywordXMP Subject Keywords Categories TagsList // meta fields ImageHeight ImageWidth MIMEType FileTypeExtension WebP_Flags Duration FileName SourceFile )
func (ExifField) IsHierarchical ¶
type Format ¶
type Format int
Format is an image file format.
func FormatFromExtension ¶
FormatFromExtension parses image format from filename extension: ".jpg" (or ".jpeg"), ".png", ".gif", ".tif" (or ".tiff"), ".bmp", ".pdf", ".b64 (or ".uue") and ".webp" are supported.
func FormatFromFilename ¶
func (Format) DecodeAnimatedWebP ¶
func (Format) MarshalText ¶
func (*Format) UnmarshalText ¶
type Img ¶
type Img struct {
Fmt Format
// contains filtered or unexported fields
}
func (*Img) DublinCore ¶
func (dec *Img) DublinCore() xmp.DublinCore
func (*Img) Save ¶
func (img *Img) Save(opts ...EncodeOption) error
type TIFFCompression ¶
type TIFFCompression int
TIFFCompression describes the type of compression used in Options.
const ( TIFFUncompressed TIFFCompression = iota TIFFDeflate )
Constants for supported TIFF compression types.
func (TIFFCompression) MarshalText ¶
func (c TIFFCompression) MarshalText() (b []byte, err error)
func (*TIFFCompression) UnmarshalText ¶
func (c *TIFFCompression) UnmarshalText(text []byte) error