composite

package
v0.0.0-...-07397a4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2018 License: MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Page reference to a page object, that contains dimensions and margins
	Page Page

	// Rows the number of rows of frames to composite on one page
	Rows int

	// Cols the number of columns of frames to composite on one page
	Cols int

	// BGColor the background color to use for parts of the page not covered by a frame, black|white
	BGColor string

	// InputDir the directory containing all of the individual frames, it is assumed nothing
	// but frame images are in this directory
	InputDir string

	// OutputDir the directory where the final composite images will be written to
	OutputDir string

	// Line1Text the text to show in the cover page, the first line of the title
	Line1Text string

	// Line2Text the text to show in the cover page, the second line of the title
	Line2Text string

	// Identifier a string printed in the margin of each page to help identify the frames
	Identifier string

	// FontBytes bytes read in from a ttf file for the font to use on the front cover
	FontBytes []byte

	// ReversePages if true we print the last page first, useful if you are printing in order,
	// so you don't have to manually reverse the pages before cutting them
	ReversePages bool

	// ReverseFrames if true we print the last frame first, useful if you want the flip book to flip
	// from back to front, which can be easier to watch sometimes
	ReverseFrames bool

	// Cover if true a cover image is rendered
	Cover bool

	// GIF if true an animated GIF is generated from the individual frames
	GIF bool

	// SmallFrames if true half size versions of each frame are created in the output dir
	SmallFrames bool

	// Effect is the name of an image processing effect to apply to each frame, values are 'oil'
	Effect string

	// VerLog a logger that will receive verbose information
	VerLog *log.Logger
}

Options allows callers to define all of the composition options

type Page

type Page struct {
	// Width of the page in inches
	Width float32

	// Height of the page in inches
	Height float32

	// MarginTop size of top margin in inches
	MarginTop float32

	// MarginRight size of right margin in inches
	MarginRight float32

	// MarginBottom size of bottom margin in inches
	MarginBottom float32

	// MarginLeft size of left margin in inches
	MarginLeft float32

	// DPI number of dots per inch e.g. 300
	DPI int
}

Page defines all of the parameters of a single page, that can hold one or more frames

type RenderInfo

type RenderInfo struct {
	// NFrames the number of frames in the flip
	NFrames int

	// FrameAR the aspect ratio of the final frames
	FrameAR float64
}

RenderInfo contains metadata about the completed job

func To4x6x3

func To4x6x3(opts Options) (RenderInfo, error)

To4x6x3 composites the source images to a 6x4 format, with 3 frames per image. Each frame will get 4x2 in dimension within the 6x4 image.

Note that the composite images are printed with maximum assembly efficiency in mind, so the images are interlaced so that you can stack all the composite images and make just two cuts to then assemble the final flip book.

So for example given input frames: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 we first discard frames 12 + 13 since we want an even multiple of 3 (3 frames per sheet) then we print in the following format

a   b   c    d

| 0 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 | | 8 | 9 | 10 | 11 |

where 0,4,8 are printed on one page, 1,5,9 on another etc. This way you can simply stack sheets a,b,c,d on top of one another, make two cuts and then put the stack together to assemble your flip book.

func ToLetter

func ToLetter(opts Options) (RenderInfo, error)

ToLetter renders the frames on a letter page, 10 frames per page

Jump to

Keyboard shortcuts

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