images

package
v0.0.0-...-4751963 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	*imagick.MagickWand
}

Image is an uncompressed image that must be convertd to blob before serving to a client.

func NewImage

func NewImage() Image

func (Image) Blob

func (img Image) Blob() []byte

Method for converting Image to blob.

func (Image) Clone

func (img Image) Clone() Image

Clone an image. Remember images and made clones need to be destroyed using Destroy().

func (Image) Convert

func (img Image) Convert(ext string) (err error)

Converts the image to different format. Takes extension as parameter.

func (Image) Crop

func (img Image) Crop(w, h, x, y int) error

Crop cuts image to requested size. Parameters x and y give offset of cropping.

func (*Image) FromBlob

func (img *Image) FromBlob(blob []byte) error

func (*Image) FromFile

func (img *Image) FromFile(filename string) error

Returns Image from file.

func (*Image) FromWeb

func (img *Image) FromWeb(url string) error

Return binary blob of an image from web.

func (Image) GetExtension

func (img Image) GetExtension() (ext string)

Returns filename extension of the image e.g. jpg, gif, webp

func (Image) GetHeight

func (img Image) GetHeight() int

Returns image height

func (Image) GetWidth

func (img Image) GetWidth() int

Returns image width

func (Image) Resize

func (img Image) Resize(w, h int) error

func (Image) Watermark

func (img Image) Watermark(watermark Image, horizontal, vertical float64) error

Watermark adds watermark Image to img. Parameters horizontal and vertical tell where watermark is placed. 0.0, 0.0 for leftmost uppercorner and 1.0, 1.0 for rigthmost lower corner.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL