convertutil

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PdfWidth                      = 1950 // Ideal max image width
	PdfHeight                     = 2350 // Ideal max image height
	KindleWidth                   = 600  // 1400
	PressDpi                      = 300
	WebDpi                        = 72
	ResolutionPixelsPerInchString = "PixelsPerInch"
	ConvertFormat                 = `convert %s -resize %sX%s %s %s %s`
)
View Source
const (
	PDFSpecs    = "1950pxw300dpi"
	KindleSpecs = "600pxw300dpi"
)

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error, stderr bytes.Buffer) error

CheckError removes the error if ReadImage doesn't work. exit status 1: convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.

func ConvertCommand

func ConvertCommand(params ConvertParams) string

func ConvertToKindle

func ConvertToKindle(sourcePath, outputPath string) (bytes.Buffer, bytes.Buffer, error)

func ConvertToPDF

func ConvertToPDF(sourcePath, outputPath string) (bytes.Buffer, bytes.Buffer, error)

func ConvertToPDFSimple

func ConvertToPDFSimple(sourcePath, outputPath string) (bytes.Buffer, bytes.Buffer, error)

func ReformatImages

func ReformatImages(baseSrcDir, baseOutDir string, copyType CopyType, rewrite bool) error

ReformatImages converts images in one dir to another using default formats for Kindle and PDF.

Types

type ConvertParams

type ConvertParams struct {
	SourcePath        string
	OutputPath        string
	OutputWidth       int
	OutputHeight      int
	ResolutionDensity int
	ResolutionUnits   ResolutionUnits
}

type CopyType

type CopyType int
const (
	PDFFormat    CopyType = iota // 0 convert cli value
	KindleFormat                 // 1 convert cli value
)

type ResolutionUnits

type ResolutionUnits int
const (
	ResolutionUndefined           ResolutionUnits = iota // 0 convert cli value
	ResolutionPixelsPerInch                              // 1 convert cli value
	ResolutionPixelsPerCentimeter                        // 2 convert cli value
)

Jump to

Keyboard shortcuts

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