Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScaledDimensions ¶
ScaledDimensions returns the newWidth and newHeight obtained when an image of dimensions w x h has to be rescaled under mw x mh, while conserving the proportions. It returns 1,1 if any of the parameter is 0.
Types ¶
type Config ¶
type Config struct {
Width, Height int
Format string
Modified bool // true if Decode actually rotated or flipped the image.
}
Config is like the standard library's image.Config as used by DecodeConfig.
func Decode ¶
Decode decodes an image from r using the provided decoding options. The Config returned is similar to the one from the image package, with the addition of the Modified field which indicates if the image was actually flipped, rotated, or scaled. If opts is nil, the defaults are used.
func DecodeConfig ¶
DecodeConfig returns the image Config similarly to the standard library's image.DecodeConfig with the addition that it also checks for an EXIF orientation, and sets the Width and Height as they would visibly be after correcting for that orientation.
type DecodeOpts ¶
type DecodeOpts struct { // Rotate specifies how to rotate the image. // If nil, the image is rotated automatically based on EXIF metadata. // If an int, Rotate is the number of degrees to rotate // counter clockwise and must be one of 0, 90, -90, 180, or // -180. Rotate interface{} // Flip specifies how to flip the image. // If nil, the image is flipped automatically based on EXIF metadata. // Otherwise, Flip is a FlipDirection bitfield indicating how to flip. Flip interface{} // MaxWidgth and MaxHeight optionally specify bounds on the // image's size. Rescaling is done before flipping or rotating. // Proportions are conserved, so the smallest of the two is used // as the decisive one if needed. MaxWidth, MaxHeight int // ScaleWidth and ScaleHeight optionally specify how to rescale the // image's dimensions. Rescaling is done before flipping or rotating. // Proportions are conserved, so the smallest of the two is used // as the decisive one if needed. // They overrule MaxWidth and MaxHeight. ScaleWidth, ScaleHeight float32 }
type FlipDirection ¶
type FlipDirection int
The FlipDirection type is used by the Flip option in DecodeOpts to indicate in which direction to flip an image.
const ( FlipVertical FlipDirection = 1 << iota FlipHorizontal )
FlipVertical and FlipHorizontal are two possible FlipDirections values to indicate in which direction an image will be flipped.
Directories ¶
Path | Synopsis |
---|---|
Package fastjpeg uses djpeg(1), from the Independent JPEG Group's (www.ijg.org) jpeg package, to quickly down-sample images on load.
|
Package fastjpeg uses djpeg(1), from the Independent JPEG Group's (www.ijg.org) jpeg package, to quickly down-sample images on load. |
Package resize resizes images.
|
Package resize resizes images. |