Documentation ¶
Overview ¶
This package provides an extensible framework for automatically generating image collages.
(C) 2021 August Schwerdfeger
This file contains auxiliary methods that run an interactive "balancing" algorithm over an existing image layout, putting each image in the center of the rectangle of blank space surrounding it.
Index ¶
- Constants
- func CreateCollage(parameters *Parameters) int
- func PaddingIsRelative(iLay ImageLayout, img ImageIdentifier) bool
- type CollageCreatorComponent
- type CollageRenderer
- type CollageRenderer_ImageMagickScript
- func (icr CollageRenderer_ImageMagickScript) CreateCollageImage(imageLayout ImageLayout) (oi OutputImage, err error)
- func (ict CollageRenderer_ImageMagickScript) ParseCustomParameters(parameters *Parameters) bool
- func (icr CollageRenderer_ImageMagickScript) RegisterCustomParameters(parameters *Parameters) bool
- type CollageRenderer_Raster
- type CollageRenderer_SVG
- type CustomParameters
- type DimensionInitializer
- type DimensionInitializer_Original
- func (dio DimensionInitializer_Original) InitializeDimensions(imageLayout ImageLayout) (il ImageLayout, err error)
- func (dio DimensionInitializer_Original) ParseCustomParameters(parameters *Parameters) bool
- func (dio DimensionInitializer_Original) RegisterCustomParameters(parameters *Parameters) bool
- type DimensionInitializer_Uniform
- type DimensionInitializer_Uniform_CustomParameters
- type DimensionInitializer_Uniform_ScaleToMinParameter
- type Dims
- func MustParseDims(arg string) Dims
- func NewDims(x, y float64) Dims
- func Overlap(iLay ImageLayout, img1, img2 ImageIdentifier) Dims
- func Padding(iLay ImageLayout, img ImageIdentifier) Dims
- func ParseDims(arg string) (d Dims, err error)
- func ScaleAndCrop(original Dims, cropping Geometry, scaling Geometry) Dims
- type Geometry
- func (geom Geometry) Crop(fullSize Dims) Dims
- func (geom Geometry) HasHeight() bool
- func (geom Geometry) HasOffset() bool
- func (geom Geometry) HasSize() bool
- func (geom Geometry) HasWidth() bool
- func (geom Geometry) HasX() bool
- func (geom Geometry) HasY() bool
- func (geom Geometry) Offset(fullSize Dims) Dims
- func (geom Geometry) PreserveAspectRatio() bool
- func (geom Geometry) Scale(fullSize Dims) Dims
- func (geom Geometry) String() string
- type GeometryDimension
- type GeometryScaling
- type GeometryUnits
- type IISBy
- type IISorter
- type ImageIdentifier
- type ImageInfo
- type ImageInfo_impl
- type ImageInfo_placeholder
- type ImageLayout
- type ImageLayout_impl
- func (iLay ImageLayout_impl) CanvasSize() Dims
- func (iLay ImageLayout_impl) ClearDimensions() ImageLayout
- func (iLay ImageLayout_impl) ClearPositions() ImageLayout
- func (iLay ImageLayout_impl) CroppingOf(img ImageIdentifier) Geometry
- func (iLay ImageLayout_impl) DimensionsOf(img ImageIdentifier) Dims
- func (iLay ImageLayout_impl) Duplicate() ImageLayout
- func (iLay ImageLayout_impl) ImageInfoOf(img ImageIdentifier) ImageInfo
- func (iLay ImageLayout_impl) Images(copy bool) []ImageIdentifier
- func (iLay ImageLayout_impl) IsNil() bool
- func (iLay ImageLayout_impl) Parameters() *Parameters
- func (iLay ImageLayout_impl) PositionOf(img ImageIdentifier) Dims
- func (iLay ImageLayout_impl) PositionedImageCount() int
- func (iLay ImageLayout_impl) ScalingOf(img ImageIdentifier) Geometry
- func (iLay ImageLayout_impl) SetCanvasSize(d Dims)
- func (iLay ImageLayout_impl) SetCropping(img ImageIdentifier, geom Geometry) (rv ImageLayout, collidedWith *ImageIdentifier)
- func (iLay ImageLayout_impl) SetPosition(img ImageIdentifier, position Dims) (rv ImageLayout, collidedWith *ImageIdentifier)
- func (iLay ImageLayout_impl) SetScaling(img ImageIdentifier, geom Geometry) (rv ImageLayout, collidedWith *ImageIdentifier)
- func (iLay ImageLayout_impl) TestCollision(newImage ImageIdentifier) *ImageIdentifier
- func (iLay ImageLayout_impl) TotalImageCount() int
- type InputImageReader
- type InputImageReader_Raster
- type InputImageReader_Raster_CustomParameters
- type OutputImage
- type OutputImage_ImageMagickScript
- type OutputImage_SVG
- type OutputImage_image
- type Parameters
- func (p Parameters) AspectRatio() (ratio float64, strict bool)
- func (p Parameters) AspectRatioGeometry() Geometry
- func (p Parameters) CollageRenderer() CollageRenderer
- func (p Parameters) DimensionInitializer() DimensionInitializer
- func (p Parameters) InFiles() []string
- func (p Parameters) InputImageReader() InputImageReader
- func (p Parameters) MaxCanvasSize() Dims
- func (p Parameters) MinCanvasSize() Dims
- func (p Parameters) Other(name string) (param interface{}, valid bool)
- func (p Parameters) OtherBool(name string) bool
- func (p Parameters) OtherDims(name string) Dims
- func (p Parameters) OtherFloat(name string) float64
- func (p Parameters) OtherGeometry(name string) Geometry
- func (p Parameters) OtherInt(name string) int
- func (p Parameters) OtherString(name string) string
- func (p Parameters) OutFile() string
- func (p Parameters) Padding() Geometry
- func (p Parameters) PositionCalculator() PositionCalculator
- func (p Parameters) ProgressMonitor() ProgressMonitor
- func (p *Parameters) SetAspectRatio(aspectRatio Geometry)
- func (p *Parameters) SetCollageRenderer(collageRenderer CollageRenderer)
- func (p *Parameters) SetDimensionInitializer(dimensionInitializer DimensionInitializer)
- func (p *Parameters) SetInFiles(inFiles []string)
- func (p *Parameters) SetInputImageReader(inputImageReader InputImageReader)
- func (p *Parameters) SetMaxCanvasSize(maxCanvasSize Dims)
- func (p *Parameters) SetMinCanvasSize(minCanvasSize Dims)
- func (p Parameters) SetOther(name string, value interface{})
- func (p *Parameters) SetOutFile(outFile string)
- func (p *Parameters) SetPadding(padding Geometry)
- func (p *Parameters) SetPositionCalculator(positionCalculator PositionCalculator)
- func (p *Parameters) SetProgressMonitor(progressMonitor ProgressMonitor)
- type PositionCalculator
- type PositionCalculator_Random
- type PositionCalculator_TileInOrder
- func (pcr PositionCalculator_TileInOrder) CalculatePositions(imageLayout ImageLayout) (il ImageLayout, err error)
- func (pcr PositionCalculator_TileInOrder) ParseCustomParameters(parameters *Parameters) bool
- func (pcr PositionCalculator_TileInOrder) RegisterCustomParameters(parameters *Parameters) bool
- type ProgressMonitor
- type ProgressMonitor_impl
- func (pmi ProgressMonitor_impl) ParseCustomParameters(parameters *Parameters) bool
- func (pmi ProgressMonitor_impl) RegisterCustomParameters(parameters *Parameters) bool
- func (pmi ProgressMonitor_impl) ReportBalanceCollision(img ImageIdentifier, fileName string, oldPos Dims)
- func (pmi ProgressMonitor_impl) ReportBalanceProgress(step int, dimIndex int, iteration int, maxImbalance int)
- func (pmi ProgressMonitor_impl) ReportBalancingFailure()
- func (pmi ProgressMonitor_impl) ReportBalancingSuccess()
- func (pmi ProgressMonitor_impl) ReportDims(msg string, dims Dims)
- func (pmi ProgressMonitor_impl) ReportMessage(msg string)
- func (pmi ProgressMonitor_impl) ReportOutputFailure(fileName string)
- func (pmi ProgressMonitor_impl) ReportOutputSuccess(fileName string)
- func (pmi ProgressMonitor_impl) ReportPositioningFailure()
- func (pmi ProgressMonitor_impl) ReportPositioningSuccess()
- func (pmi ProgressMonitor_impl) ReportRandomPositioningProgress(canvasSize Dims, currentCanvasTry int, maxCanvasTries int, ...)
- func (pmi ProgressMonitor_impl) ReportRenderingFailure()
- func (pmi ProgressMonitor_impl) ReportRenderingProgress(currentImage int, imageCount int)
- func (pmi ProgressMonitor_impl) ReportRenderingSuccess()
- func (pmi ProgressMonitor_impl) ReportRuntimeError(msg string, err error)
- func (pmi ProgressMonitor_impl) ReportTileInOrderPositioningProgress(canvasSize Dims, badness tileInOrder_Badness)
Constants ¶
const ( Uniform_Cropping string = "Uniform_Cropping" Uniform_Scaling string = "Uniform_Scaling" Uniform_ScaleToMin string = "Uniform_ScaleToMin" )
const ( Random_SeedNumber string = "Random_SeedNumber" Random_MaxLayoutTries string = "Random_MaxLayoutTries" Random_MaxTriesPerImage string = "Random_MaxTriesPerImage" Random_SizeToleranceFactor string = "Random_SizeToleranceFactor" Balancer_MaxBalanceIterations string = "Balancer_MaxBalanceIterations" Balancer_BalanceToleranceFactor string = "Balancer_BalanceToleranceFactor" )
const ( TileInOrder_ExactOrder string = "TileInOrder_ExactOrder" TileInOrder_Columns string = "TileInOrder_Columns" )
const (
Raster_PreloadImages string = "Raster_PreloadImages"
)
Variables ¶
This section is empty.
Functions ¶
func CreateCollage ¶
func CreateCollage(parameters *Parameters) int
Runs the complete collage-creation process from reading input files to producing the output file; returns 0 if successful and nonzero if not.
func PaddingIsRelative ¶
func PaddingIsRelative(iLay ImageLayout, img ImageIdentifier) bool
Determines whether the padding to be maintained around the given image is in relative or absolute units.
Types ¶
type CollageCreatorComponent ¶
type CollageCreatorComponent interface { // Adds information to 'parameters' about any custom parameters accepted by this object. RegisterCustomParameters(parameters *Parameters) bool // Parses, using Go's 'flag' library, any custom parameters in 'parameters' accepted by this object. ParseCustomParameters(parameters *Parameters) bool }
A superinterface for any object that adds custom parameters to the CollageCreator CLI.
type CollageRenderer ¶
type CollageRenderer interface { CollageCreatorComponent // Takes 'imageLayout' after it has been through a 'PositionCalculator' and produces an object // ready to write to output file(s), or error on failure. CreateCollageImage(imageLayout ImageLayout) (oi OutputImage, err error) }
A superinterface for any object that renders a finished image layout to a ready-to-write output image.
type CollageRenderer_ImageMagickScript ¶
type CollageRenderer_ImageMagickScript struct{}
Produces output in the form of a Bash script that, when run, will call ImageMagick to produce the output collage.
func CollageRenderer_ImageMagickScript_Init ¶
func CollageRenderer_ImageMagickScript_Init() CollageRenderer_ImageMagickScript
func (CollageRenderer_ImageMagickScript) CreateCollageImage ¶
func (icr CollageRenderer_ImageMagickScript) CreateCollageImage(imageLayout ImageLayout) (oi OutputImage, err error)
func (CollageRenderer_ImageMagickScript) ParseCustomParameters ¶
func (ict CollageRenderer_ImageMagickScript) ParseCustomParameters(parameters *Parameters) bool
func (CollageRenderer_ImageMagickScript) RegisterCustomParameters ¶
func (icr CollageRenderer_ImageMagickScript) RegisterCustomParameters(parameters *Parameters) bool
type CollageRenderer_Raster ¶
type CollageRenderer_Raster struct{}
Produces output in the form of a JPEG, PNG, or TIFF file, using Jan Schlicht's "resize" package to handle scaling.
func CollageRenderer_Raster_Init ¶
func CollageRenderer_Raster_Init() CollageRenderer_Raster
func (CollageRenderer_Raster) CreateCollageImage ¶
func (icr CollageRenderer_Raster) CreateCollageImage(imageLayout ImageLayout) (oi OutputImage, err error)
func (CollageRenderer_Raster) ParseCustomParameters ¶
func (ict CollageRenderer_Raster) ParseCustomParameters(parameters *Parameters) bool
func (CollageRenderer_Raster) RegisterCustomParameters ¶
func (icr CollageRenderer_Raster) RegisterCustomParameters(parameters *Parameters) bool
type CollageRenderer_SVG ¶
type CollageRenderer_SVG struct{}
Produces output in the form of an SVG file that links to all the input images.
func CollageRenderer_SVG_Init ¶
func CollageRenderer_SVG_Init() CollageRenderer_SVG
func (CollageRenderer_SVG) CreateCollageImage ¶
func (icr CollageRenderer_SVG) CreateCollageImage(imageLayout ImageLayout) (oi OutputImage, err error)
func (CollageRenderer_SVG) ParseCustomParameters ¶
func (ict CollageRenderer_SVG) ParseCustomParameters(parameters *Parameters) bool
func (CollageRenderer_SVG) RegisterCustomParameters ¶
func (icr CollageRenderer_SVG) RegisterCustomParameters(parameters *Parameters) bool
type CustomParameters ¶
type CustomParameters map[string]interface{}
A map holding "custom" parameters specific to one component.
type DimensionInitializer ¶
type DimensionInitializer interface { CollageCreatorComponent // Initialize the dimensions of each image in 'imageLayout'. Returns error on failure, // or 'il' on success, which may be, but is not guaranteed to be, a separate object // from 'imageLayout'. InitializeDimensions(imageLayout ImageLayout) (il ImageLayout, err error) }
A superinterface for any object that initializes crop and scale settings for each input image before positioning starts (e.g., by scaling each image to a uniform size).
type DimensionInitializer_Original ¶
type DimensionInitializer_Original struct{}
The simplest 'DimensionInitializer': sends all images through as-is.
func (DimensionInitializer_Original) InitializeDimensions ¶
func (dio DimensionInitializer_Original) InitializeDimensions(imageLayout ImageLayout) (il ImageLayout, err error)
func (DimensionInitializer_Original) ParseCustomParameters ¶
func (dio DimensionInitializer_Original) ParseCustomParameters(parameters *Parameters) bool
func (DimensionInitializer_Original) RegisterCustomParameters ¶
func (dio DimensionInitializer_Original) RegisterCustomParameters(parameters *Parameters) bool
type DimensionInitializer_Uniform ¶
type DimensionInitializer_Uniform struct {
// contains filtered or unexported fields
}
A 'DimensionInitializer' that applies uniform cropping and scaling rules, specified as ImageMagick geometry strings, to all input images.
func DimensionInitializer_Uniform_Init ¶
func DimensionInitializer_Uniform_Init() DimensionInitializer_Uniform
func (DimensionInitializer_Uniform) InitializeDimensions ¶
func (dio DimensionInitializer_Uniform) InitializeDimensions(imageLayout ImageLayout) (il ImageLayout, err error)
func (DimensionInitializer_Uniform) ParseCustomParameters ¶
func (dio DimensionInitializer_Uniform) ParseCustomParameters(parameters *Parameters) bool
func (DimensionInitializer_Uniform) RegisterCustomParameters ¶
func (dio DimensionInitializer_Uniform) RegisterCustomParameters(parameters *Parameters) bool
type DimensionInitializer_Uniform_CustomParameters ¶
type DimensionInitializer_Uniform_CustomParameters struct {
// contains filtered or unexported fields
}
type DimensionInitializer_Uniform_ScaleToMinParameter ¶
type DimensionInitializer_Uniform_ScaleToMinParameter struct {
// contains filtered or unexported fields
}
type Dims ¶
type Dims struct {
// contains filtered or unexported fields
}
Holds a pair of floats representing dimensions or coordinates.
func MustParseDims ¶
A front-end to 'ParseDims' that logs a fatal error if the string does not parse.
func Overlap ¶
func Overlap(iLay ImageLayout, img1, img2 ImageIdentifier) Dims
func Padding ¶
func Padding(iLay ImageLayout, img ImageIdentifier) Dims
Calculates the padding to be maintained around the given image.
func ParseDims ¶
Parses a string into a 'Dims' object. The string must consist of either one non-negative integer, or two non-negative integers separated by a comma or 'x'. Returns the parsed object, and an error if the string is malformed.
func ScaleAndCrop ¶
Apply both the 'Scale' and 'Crop' methods to a given image, in that order.
func (Dims) Dim ¶
Gets the coordinate in a 'Dims' object indicated by the parameter: X if even, Y if odd.
type Geometry ¶
type Geometry struct {
// contains filtered or unexported fields
}
Represents the geometry of an image operation such as cropping or scaling, as parsed from an ImageMagick-like "geometry" string.
func EmptyGeometry ¶
func EmptyGeometry() Geometry
Generates an "empty" 'Geometry' object in which all numeric values are 'NaN'.
func MustParseGeometry ¶
A front-end to 'ParseGeometry' that logs a fatal error if the string does not parse.
func ParseGeometry ¶
Parses a string into a 'Geometry' object. The string must follow the format of an ImageMagick 'geometry' parameter. Returns the parsed object, and an error if the string is malformed.
func (Geometry) Crop ¶
Calculate the size of an image cropped using this 'Geometry' object, relative to an image of the given size. 'fullSize' is taken into account only when the 'Percent' relative units are used.
func (Geometry) HasOffset ¶
Returns true if this 'Geometry' object explicitly specifies either a horizontal or a vertical offset.
func (Geometry) HasSize ¶
Returns true if this 'Geometry' object explicitly specifies either a width or a height.
func (Geometry) HasX ¶
Returns true if this 'Geometry' object explicitly specifies a horizontal offset.
func (Geometry) HasY ¶
Returns true if this 'Geometry' object explicitly specifies a vertical offset.
func (Geometry) Offset ¶
Calculate the offset of this 'Geometry' object relative to an image of the given size. 'fullSize' is taken into account only when the 'Percent' relative units are used.
func (Geometry) PreserveAspectRatio ¶
Returns true if this 'Geometry' object specifies preservation of the aspect ratio.
type GeometryDimension ¶
type GeometryDimension struct { N float64 U GeometryUnits }
A unit-bearing image measurement.
type GeometryScaling ¶
type GeometryScaling int
Types of scaling supported by the 'Geometry' type.
const ( // Always scale, no matter the size of the image to be scaled. ScaleAlways GeometryScaling = iota // Scale only if the image is larger than the given size. ScaleDownOnly // Scale only if the image is smaller than the given size. ScaleUpOnly )
type GeometryUnits ¶
type GeometryUnits int
Units supported by the 'Geometry' type.
const ( Pixels GeometryUnits = iota Percent )
type IISBy ¶
type IISBy func(lhs, rhs *ImageIdentifier) bool
A comparator for ImageIdentifiers, to be used in sorting images.
func (IISBy) Sort ¶
func (by IISBy) Sort(ids []ImageIdentifier)
type ImageIdentifier ¶
type ImageIdentifier int
An identifier assigned to an input image as it is read in.
type ImageInfo ¶
type ImageInfo interface { ImageId() ImageIdentifier FileName() string DimensionsOf() Dims ImageData() interface{} }
Holds information about an input image.
type ImageInfo_impl ¶
type ImageInfo_impl struct {
// contains filtered or unexported fields
}
An ImageInfo implementation that stores all of an image's pixel data.
func (ImageInfo_impl) DimensionsOf ¶
func (iii ImageInfo_impl) DimensionsOf() Dims
func (ImageInfo_impl) FileName ¶
func (iii ImageInfo_impl) FileName() string
func (ImageInfo_impl) ImageData ¶
func (iii ImageInfo_impl) ImageData() interface{}
func (ImageInfo_impl) ImageId ¶
func (iii ImageInfo_impl) ImageId() ImageIdentifier
type ImageInfo_placeholder ¶
type ImageInfo_placeholder struct {
// contains filtered or unexported fields
}
An ImageInfo implementation that stores only the filename and dimension of an image and not all the pixel data.
func (ImageInfo_placeholder) DimensionsOf ¶
func (iip ImageInfo_placeholder) DimensionsOf() Dims
func (ImageInfo_placeholder) FileName ¶
func (iip ImageInfo_placeholder) FileName() string
func (ImageInfo_placeholder) ImageData ¶
func (iip ImageInfo_placeholder) ImageData() interface{}
func (ImageInfo_placeholder) ImageId ¶
func (iip ImageInfo_placeholder) ImageId() ImageIdentifier
type ImageLayout ¶
type ImageLayout interface { // Most of the content of an ImageLayout is stored as a reference. This returns true if that is a nil reference. IsNil() bool // Creates a full copy of this ImageLayout. Duplicate() ImageLayout // The parameters assigned to this ImageLayout. Parameters() *Parameters // The total number of constituent images in this ImageLayout. TotalImageCount() int // The number of images in this ImageLayout that have been positioned in the collage. PositionedImageCount() int // Gets the size of the output image being generated. CanvasSize() Dims // Sets the size of the output image being generated. SetCanvasSize(d Dims) // Gets the list of images in this ImageLayout, a reference or a copy per the parameter. Images(copy bool) []ImageIdentifier // Gets the 'ImageInfo' for the given image. ImageInfoOf(img ImageIdentifier) ImageInfo // Clears all the position information set in this ImageLayout. ClearPositions() ImageLayout // Clears all the scaling information set in this ImageLayout. ClearDimensions() ImageLayout // Gets the position information for the given image. PositionOf(img ImageIdentifier) Dims // Sets the position information for the given image. Returns an ImageLayout including the new position // (which may or may not be the same object as the input ImageLayout) and, if the image as positioned // collided with another image, a pointer to that image. SetPosition(img ImageIdentifier, position Dims) (rv ImageLayout, collidedWith *ImageIdentifier) // Gets the dimensions of the given image as it will be placed on the canvas. DimensionsOf(img ImageIdentifier) Dims // Gets the cropping information for the given image. CroppingOf(img ImageIdentifier) Geometry // Sets the cropping information for the given image. Returns an ImageLayout including the new cropping information // (which may or may not be the same object as the input ImageLayout) and, if the image as positioned // collided with another image, a pointer to that image. SetCropping(img ImageIdentifier, geom Geometry) (rv ImageLayout, collidedWith *ImageIdentifier) // Gets the scaling information for the given image. ScalingOf(img ImageIdentifier) Geometry // Sets the scaling information for the given image. Returns an ImageLayout including the new scaling information // (which may or may not be the same object as the input ImageLayout) and, if the image as positioned // collided with another image, a pointer to that image. SetScaling(img ImageIdentifier, geom Geometry) (rv ImageLayout, collidedWith *ImageIdentifier) // Tests whether an image, positioned in the ImageLayout, collides with any others. TestCollision(newImage ImageIdentifier) *ImageIdentifier }
Represents the layout of the collage: the positions and scaled/cropped dimensions of each constituent image.
func Balance ¶
func Balance(iLay ImageLayout) ImageLayout
Run an iterative "balancing" algorithm on an existing image layout that attempts to center each image within the rectangle of blank space around it.
func CreateNilImageLayout ¶
func CreateNilImageLayout() ImageLayout
Creates a "nil" image layout object (used to indicate an error).
type ImageLayout_impl ¶
type ImageLayout_impl struct {
// contains filtered or unexported fields
}
func (ImageLayout_impl) CanvasSize ¶
func (iLay ImageLayout_impl) CanvasSize() Dims
func (ImageLayout_impl) ClearDimensions ¶
func (iLay ImageLayout_impl) ClearDimensions() ImageLayout
func (ImageLayout_impl) ClearPositions ¶
func (iLay ImageLayout_impl) ClearPositions() ImageLayout
func (ImageLayout_impl) CroppingOf ¶
func (iLay ImageLayout_impl) CroppingOf(img ImageIdentifier) Geometry
func (ImageLayout_impl) DimensionsOf ¶
func (iLay ImageLayout_impl) DimensionsOf(img ImageIdentifier) Dims
func (ImageLayout_impl) Duplicate ¶
func (iLay ImageLayout_impl) Duplicate() ImageLayout
func (ImageLayout_impl) ImageInfoOf ¶
func (iLay ImageLayout_impl) ImageInfoOf(img ImageIdentifier) ImageInfo
func (ImageLayout_impl) Images ¶
func (iLay ImageLayout_impl) Images(copy bool) []ImageIdentifier
func (ImageLayout_impl) IsNil ¶
func (iLay ImageLayout_impl) IsNil() bool
Most of the content of an ImageLayout is stored as a reference. This returns true if that is a nil reference.
func (ImageLayout_impl) Parameters ¶
func (iLay ImageLayout_impl) Parameters() *Parameters
func (ImageLayout_impl) PositionOf ¶
func (iLay ImageLayout_impl) PositionOf(img ImageIdentifier) Dims
func (ImageLayout_impl) PositionedImageCount ¶
func (iLay ImageLayout_impl) PositionedImageCount() int
func (ImageLayout_impl) ScalingOf ¶
func (iLay ImageLayout_impl) ScalingOf(img ImageIdentifier) Geometry
func (ImageLayout_impl) SetCanvasSize ¶
func (iLay ImageLayout_impl) SetCanvasSize(d Dims)
func (ImageLayout_impl) SetCropping ¶
func (iLay ImageLayout_impl) SetCropping(img ImageIdentifier, geom Geometry) (rv ImageLayout, collidedWith *ImageIdentifier)
func (ImageLayout_impl) SetPosition ¶
func (iLay ImageLayout_impl) SetPosition(img ImageIdentifier, position Dims) (rv ImageLayout, collidedWith *ImageIdentifier)
func (ImageLayout_impl) SetScaling ¶
func (iLay ImageLayout_impl) SetScaling(img ImageIdentifier, geom Geometry) (rv ImageLayout, collidedWith *ImageIdentifier)
func (ImageLayout_impl) TestCollision ¶
func (iLay ImageLayout_impl) TestCollision(newImage ImageIdentifier) *ImageIdentifier
func (ImageLayout_impl) TotalImageCount ¶
func (iLay ImageLayout_impl) TotalImageCount() int
type InputImageReader ¶
type InputImageReader interface { CollageCreatorComponent // Read input images as specified in 'parameters'; // return the ImageLayout object 'il' on success or error on failure. ReadInputImages(parameters *Parameters) (il ImageLayout, err error) }
A superinterface for any object that reads images into a layout.
type InputImageReader_Raster ¶
type InputImageReader_Raster struct {
// contains filtered or unexported fields
}
An InputImageReader that reads raster images in any format supported by the Go 'image' library.
func InputImageReader_Raster_Init ¶
func InputImageReader_Raster_Init() InputImageReader_Raster
func (InputImageReader_Raster) ParseCustomParameters ¶
func (iicio InputImageReader_Raster) ParseCustomParameters(parameters *Parameters) bool
func (InputImageReader_Raster) ReadInputImages ¶
func (iicio InputImageReader_Raster) ReadInputImages(parameters *Parameters) (il ImageLayout, err error)
func (InputImageReader_Raster) RegisterCustomParameters ¶
func (iicio InputImageReader_Raster) RegisterCustomParameters(parameters *Parameters) bool
type InputImageReader_Raster_CustomParameters ¶
type InputImageReader_Raster_CustomParameters struct {
// contains filtered or unexported fields
}
type OutputImage ¶
type OutputImage interface {
WriteToFile(fileName string, parameters *Parameters)
}
A superinterface for any object that holds an image ready to write to a file.
type OutputImage_ImageMagickScript ¶
type OutputImage_ImageMagickScript struct {
// contains filtered or unexported fields
}
Produces output in the form of a Bash script that, when run, will call ImageMagick to produce the output collage.
func (OutputImage_ImageMagickScript) WriteToFile ¶
func (ois OutputImage_ImageMagickScript) WriteToFile(fileName string, parameters *Parameters)
type OutputImage_SVG ¶
type OutputImage_SVG struct {
// contains filtered or unexported fields
}
Produces output in the form of an SVG file that links to all the input images.
func (OutputImage_SVG) WriteToFile ¶
func (ois OutputImage_SVG) WriteToFile(fileName string, parameters *Parameters)
type OutputImage_image ¶
type OutputImage_image struct {
// contains filtered or unexported fields
}
Produces output in the form of a JPEG, PNG, or TIFF file, using Jan Schlicht's "resize" package to handle scaling.
func (OutputImage_image) WriteToFile ¶
func (oii OutputImage_image) WriteToFile(fileName string, parameters *Parameters)
type Parameters ¶
type Parameters struct {
// contains filtered or unexported fields
}
Holds parameters to CollageCreator.
func (Parameters) AspectRatio ¶
func (p Parameters) AspectRatio() (ratio float64, strict bool)
Gets the target aspect ratio for the final output image, in the form of a float and a boolean indicating whether this number is a preference or a strict requirement.
func (Parameters) AspectRatioGeometry ¶
func (p Parameters) AspectRatioGeometry() Geometry
Gets the target aspect ratio for the final output image, in Geometry form.
func (Parameters) CollageRenderer ¶
func (p Parameters) CollageRenderer() CollageRenderer
Gets the CollageRenderer to be used for this run.
func (Parameters) DimensionInitializer ¶
func (p Parameters) DimensionInitializer() DimensionInitializer
Gets the DimensionInitializer to be used for this run.
func (Parameters) InFiles ¶
func (p Parameters) InFiles() []string
Gets the list of pathnames representing input images.
func (Parameters) InputImageReader ¶
func (p Parameters) InputImageReader() InputImageReader
Gets the InputImageReader to be used for this run.
func (Parameters) MaxCanvasSize ¶
func (p Parameters) MaxCanvasSize() Dims
Gets the maximum acceptable size of the final output image (0 signifying no limit).
func (Parameters) MinCanvasSize ¶
func (p Parameters) MinCanvasSize() Dims
Gets the minimum acceptable size of the final output image (0 signifying no limit).
func (Parameters) Other ¶
func (p Parameters) Other(name string) (param interface{}, valid bool)
Gets a component-specific custom parameter by name, returning the value and a boolean that is false if the parameter has not been set.
func (Parameters) OtherBool ¶
func (p Parameters) OtherBool(name string) bool
Gets by name a component-specific system parameter known to be a boolean, logging a fatal error if it is of any other type.
func (Parameters) OtherDims ¶
func (p Parameters) OtherDims(name string) Dims
Gets by name a component-specific system parameter known to be of type 'Dims', logging a fatal error if it is of any other type.
func (Parameters) OtherFloat ¶
func (p Parameters) OtherFloat(name string) float64
Gets by name a component-specific system parameter known to be a float, logging a fatal error if it is of any other type.
func (Parameters) OtherGeometry ¶
func (p Parameters) OtherGeometry(name string) Geometry
Gets by name a component-specific system parameter known to be of type 'Geometry', logging a fatal error if it is of any other type.
func (Parameters) OtherInt ¶
func (p Parameters) OtherInt(name string) int
Gets by name a component-specific system parameter known to be an integer, logging a fatal error if it is of any other type.
func (Parameters) OtherString ¶
func (p Parameters) OtherString(name string) string
Gets by name a component-specific system parameter known to be a string, logging a fatal error if it is of any other type.
func (Parameters) OutFile ¶
func (p Parameters) OutFile() string
Gets the pathname where the output is to be placed.
func (Parameters) Padding ¶
func (p Parameters) Padding() Geometry
Gets the Geometry governing padding around images during placement.
func (Parameters) PositionCalculator ¶
func (p Parameters) PositionCalculator() PositionCalculator
Gets the PositionCalculator to be used for this run.
func (Parameters) ProgressMonitor ¶
func (p Parameters) ProgressMonitor() ProgressMonitor
Gets the ProgressMonitor used to report status.
func (*Parameters) SetAspectRatio ¶
func (p *Parameters) SetAspectRatio(aspectRatio Geometry)
Gets the target aspect ratio for the final output image.
func (*Parameters) SetCollageRenderer ¶
func (p *Parameters) SetCollageRenderer(collageRenderer CollageRenderer)
Sets the CollageRenderer to be used for this run.
func (*Parameters) SetDimensionInitializer ¶
func (p *Parameters) SetDimensionInitializer(dimensionInitializer DimensionInitializer)
Sets the DimensionInitializer to be used for this run.
func (*Parameters) SetInFiles ¶
func (p *Parameters) SetInFiles(inFiles []string)
Sets the list of pathnames representing input images.
func (*Parameters) SetInputImageReader ¶
func (p *Parameters) SetInputImageReader(inputImageReader InputImageReader)
Sets the InputImageReader to be used for this run.
func (*Parameters) SetMaxCanvasSize ¶
func (p *Parameters) SetMaxCanvasSize(maxCanvasSize Dims)
Gets the maximum acceptable size of the final output image (0 signifying no limit).
func (*Parameters) SetMinCanvasSize ¶
func (p *Parameters) SetMinCanvasSize(minCanvasSize Dims)
Sets the minimum acceptable size of the final output image (0 signifying no limit).
func (Parameters) SetOther ¶
func (p Parameters) SetOther(name string, value interface{})
Sets a component-specific parameter by name.
func (*Parameters) SetOutFile ¶
func (p *Parameters) SetOutFile(outFile string)
Sets the pathname where the output is to be placed.
func (*Parameters) SetPadding ¶
func (p *Parameters) SetPadding(padding Geometry)
Sets the Geometry governing padding around images during placement.
func (*Parameters) SetPositionCalculator ¶
func (p *Parameters) SetPositionCalculator(positionCalculator PositionCalculator)
Sets the PositionCalculator to be used for this run.
func (*Parameters) SetProgressMonitor ¶
func (p *Parameters) SetProgressMonitor(progressMonitor ProgressMonitor)
Sets the ProgressMonitor used to report status.
type PositionCalculator ¶
type PositionCalculator interface { CollageCreatorComponent // Find a place on a canvas for each image in 'imageLayout'. Returns error on failure, // or 'il' on success, which may be, but is not guaranteed to be, a separate object // from 'imageLayout'. CalculatePositions(imageLayout ImageLayout) (il ImageLayout, err error) }
A superinterface for any object that positions images on the collage.
type PositionCalculator_Random ¶
type PositionCalculator_Random struct {
// contains filtered or unexported fields
}
A PositionCalculator that places images randomly on the canvas.
func PositionCalculator_Random_Init ¶
func PositionCalculator_Random_Init() PositionCalculator_Random
func (PositionCalculator_Random) CalculatePositions ¶
func (pcr PositionCalculator_Random) CalculatePositions(imageLayout ImageLayout) (il ImageLayout, err error)
func (PositionCalculator_Random) ParseCustomParameters ¶
func (pcr PositionCalculator_Random) ParseCustomParameters(parameters *Parameters) bool
func (PositionCalculator_Random) RegisterCustomParameters ¶
func (pcr PositionCalculator_Random) RegisterCustomParameters(parameters *Parameters) bool
type PositionCalculator_TileInOrder ¶
type PositionCalculator_TileInOrder struct {
// contains filtered or unexported fields
}
A PositionCalculator that places images in a tiling pattern.
func PositionCalculator_TileInOrder_Init ¶
func PositionCalculator_TileInOrder_Init() PositionCalculator_TileInOrder
func (PositionCalculator_TileInOrder) CalculatePositions ¶
func (pcr PositionCalculator_TileInOrder) CalculatePositions(imageLayout ImageLayout) (il ImageLayout, err error)
func (PositionCalculator_TileInOrder) ParseCustomParameters ¶
func (pcr PositionCalculator_TileInOrder) ParseCustomParameters(parameters *Parameters) bool
func (PositionCalculator_TileInOrder) RegisterCustomParameters ¶
func (pcr PositionCalculator_TileInOrder) RegisterCustomParameters(parameters *Parameters) bool
type ProgressMonitor ¶
type ProgressMonitor interface { CollageCreatorComponent // Reports an unstructured message. ReportMessage(msg string) // Reports an unstructured runtime error. ReportRuntimeError(msg string, err error) // Reports that positioning has failed. ReportPositioningFailure() // Reports that positioning has succeeded. ReportPositioningSuccess() // Reports a set of dimensions. ReportDims(msg string, dims Dims) // Reports the progress of rendering, in terms of images rendered and still to render. ReportRenderingProgress(currentImage int, imageCount int) // Reports that rendering was a success. ReportRenderingSuccess() // Reports that rendering was a failure. ReportRenderingFailure() // Reports that output to a given file was a success. ReportOutputSuccess(fileName string) // Reports that output to a given file was a failure. ReportOutputFailure(fileName string) // Reports the progress of the random layout method: // the canvas size being tried; the number of canvas sizes tried so far and still to be tried; // the number of images positioned and still to be positioned; the number of attempts made // and still to make to position the current image. ReportRandomPositioningProgress(canvasSize Dims, currentCanvasTry int, maxCanvasTries int, currentPositionedCount int, totalImageCount int, currentImageTry int, maxImageTries int) // Reports the progress of the random layout method. ReportTileInOrderPositioningProgress(canvasSize Dims, badness tileInOrder_Badness) // Reports the progress of the whitespace-balancing post-process of the random layout method: // how many balancing steps have been taken; whether horizontal or vertical whitespace // is being balanced; how many iterations of balancing have been taken in the current // step; the maximum amount of whitespace imbalance still existing. ReportBalanceProgress(step int, dimIndex int, iteration int, maxImbalance int) // Reports a collision or overlap between two positioned images -- normally should not happen. ReportBalanceCollision(img ImageIdentifier, fileName string, oldPos Dims) // Reports that the whitespace-balancing post-process of the random layout method was a success. ReportBalancingSuccess() // Reports that the whitespace-balancing post-process of the random layout method was a failure. ReportBalancingFailure() }
A superinterface for any object that reports the progress of the collage creator.
type ProgressMonitor_impl ¶
type ProgressMonitor_impl struct{}
func ProgressMonitor_Init ¶
func ProgressMonitor_Init() ProgressMonitor_impl
func (ProgressMonitor_impl) ParseCustomParameters ¶
func (pmi ProgressMonitor_impl) ParseCustomParameters(parameters *Parameters) bool
func (ProgressMonitor_impl) RegisterCustomParameters ¶
func (pmi ProgressMonitor_impl) RegisterCustomParameters(parameters *Parameters) bool
func (ProgressMonitor_impl) ReportBalanceCollision ¶
func (pmi ProgressMonitor_impl) ReportBalanceCollision(img ImageIdentifier, fileName string, oldPos Dims)
func (ProgressMonitor_impl) ReportBalanceProgress ¶
func (pmi ProgressMonitor_impl) ReportBalanceProgress(step int, dimIndex int, iteration int, maxImbalance int)
func (ProgressMonitor_impl) ReportBalancingFailure ¶
func (pmi ProgressMonitor_impl) ReportBalancingFailure()
func (ProgressMonitor_impl) ReportBalancingSuccess ¶
func (pmi ProgressMonitor_impl) ReportBalancingSuccess()
func (ProgressMonitor_impl) ReportDims ¶
func (pmi ProgressMonitor_impl) ReportDims(msg string, dims Dims)
func (ProgressMonitor_impl) ReportMessage ¶
func (pmi ProgressMonitor_impl) ReportMessage(msg string)
func (ProgressMonitor_impl) ReportOutputFailure ¶
func (pmi ProgressMonitor_impl) ReportOutputFailure(fileName string)
func (ProgressMonitor_impl) ReportOutputSuccess ¶
func (pmi ProgressMonitor_impl) ReportOutputSuccess(fileName string)
func (ProgressMonitor_impl) ReportPositioningFailure ¶
func (pmi ProgressMonitor_impl) ReportPositioningFailure()
func (ProgressMonitor_impl) ReportPositioningSuccess ¶
func (pmi ProgressMonitor_impl) ReportPositioningSuccess()
func (ProgressMonitor_impl) ReportRandomPositioningProgress ¶
func (ProgressMonitor_impl) ReportRenderingFailure ¶
func (pmi ProgressMonitor_impl) ReportRenderingFailure()
func (ProgressMonitor_impl) ReportRenderingProgress ¶
func (pmi ProgressMonitor_impl) ReportRenderingProgress(currentImage int, imageCount int)
func (ProgressMonitor_impl) ReportRenderingSuccess ¶
func (pmi ProgressMonitor_impl) ReportRenderingSuccess()
func (ProgressMonitor_impl) ReportRuntimeError ¶
func (pmi ProgressMonitor_impl) ReportRuntimeError(msg string, err error)
func (ProgressMonitor_impl) ReportTileInOrderPositioningProgress ¶
func (pmi ProgressMonitor_impl) ReportTileInOrderPositioningProgress(canvasSize Dims, badness tileInOrder_Badness)