Documentation ¶
Index ¶
- func MimeType(extension string) string
- type Converter
- type Dimensions
- type FFmpegConverter
- func (c *FFmpegConverter) OnPreGeneration(fn func(cmd string, args ...string))
- func (c *FFmpegConverter) ToAVIF(srcPath string, destPath string, dimensions Dimensions) error
- func (c *FFmpegConverter) ToMP3(srcPath string, destPath string) error
- func (c *FFmpegConverter) ToWebM(srcPath string, destPath string) error
- type RandomConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dimensions ¶
Dimensions regroups the width and height of an image.
func OriginalSize ¶
func OriginalSize() Dimensions
func ReadImageDimensions ¶
func ReadImageDimensions(path string) (Dimensions, error)
ReadImageDimensions extracts the dimensions from a GIF/PNG/JPEG file.
func ResizeTo ¶
func ResizeTo(maxWidthOrHeight int) Dimensions
func (Dimensions) Landscape ¶
func (d Dimensions) Landscape() bool
func (Dimensions) LargerThan ¶
func (d Dimensions) LargerThan(widthOrHeight int) bool
LargerThan returns if at least one dimension exceeds the given size. LargerThan is conservatrice and returns true if dimensions are not available.
func (Dimensions) Portrait ¶
func (d Dimensions) Portrait() bool
func (Dimensions) String ¶
func (d Dimensions) String() string
func (Dimensions) Zero ¶
func (d Dimensions) Zero() bool
Zero returns if the dimensions are not available.
type FFmpegConverter ¶
type FFmpegConverter struct {
// contains filtered or unexported fields
}
func NewFFmpegConverter ¶
func NewFFmpegConverter(preset string) (*FFmpegConverter, error)
func (*FFmpegConverter) OnPreGeneration ¶
func (c *FFmpegConverter) OnPreGeneration(fn func(cmd string, args ...string))
func (*FFmpegConverter) ToAVIF ¶
func (c *FFmpegConverter) ToAVIF(srcPath string, destPath string, dimensions Dimensions) error
ConvertToAVIF convert a picture to AVIF format. Requirements:
brew install ffmpeg
type RandomConverter ¶
type RandomConverter struct{}
RandomConverter generates files containing fake data. Useful in tests to avoid waiting for a command like ffmpeg to finish.
func NewRandomConverter ¶
func NewRandomConverter() *RandomConverter
func (*RandomConverter) OnPreGeneration ¶
func (c *RandomConverter) OnPreGeneration(fn func(cmd string, args ...string))
func (*RandomConverter) ToAVIF ¶
func (c *RandomConverter) ToAVIF(src, dest string, dimensions Dimensions) error
func (*RandomConverter) ToMP3 ¶
func (c *RandomConverter) ToMP3(src, dest string) error
func (*RandomConverter) ToWebM ¶
func (c *RandomConverter) ToWebM(src, dest string) error
Click to show internal directories.
Click to hide internal directories.