Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Geometry ¶
func ParseGeometry ¶
ParseGeometry parse a geometry string in the form of "WIDTHxHEIGHT{+}X{+}Y{!<>}"
WIDTH and HEIGHT are integers, and can be followed by '%' to indicate percentage.
One WIDTH or HEIGHT is required.
X and Y are offsets, and must be preceded by '+'.
The '!' flag forces the image to be resized to the specified dimensions.
The '<' flag only allows the image to be resized if it is smaller than the specified dimensions.
The '>' flag only allows the image to be resized if it is larger than the specified dimensions.
The '^' flag forces the image to fill the smallest dimension of the specified dimensions.
Examples:
"100x200" - width 100, height 200 "50%x50%" - width 50%, height 50% "300x" - width 300 "x400" - height 400 "100x200+50+50%" - width 100, height 200, x offset 50, y offset 50% "+50+50" - x offset 50, y offset 50, width and height are 100% of the http of the image "100x100%+50+50" - width 100, height 100%, x offset 50, y offset 50
func (Geometry) ApplyMeta ¶
ApplyMeta returns a geometry that is modified as determined by the meta characters: %, !, <, >, ^ in relation to the provided image.
Final image dimensions are adjusted so as to preserve the aspect ratio as much as possible, while generating a integer (pixel) size, and fitting the image within the specified geometry width and height.
Flags are interpreted...
% geometry size is given percentage of original width and height given ! do not try to preserve aspect ratio < only enlarge images smaller that geometry > only shrink images larger than geometry ^ fill given area
A description of each parameter follows:
o geometry: The geometry string (e.g. "100x100+10+10"). o x,y: The x and y offset, set according to the geometry specification. o width,height: The width and height of original image, modified by the given geometry specification.