Documentation
¶
Index ¶
- func FileType(path string) string
- type Converter
- func (c *Converter) Cancel()
- func (c *Converter) Combine(files []File) error
- func (c *Converter) Convert(file File) error
- func (c *Converter) Cover(file File) error
- func (c *Converter) CoverPreview(fileName string, fileInfo os.FileInfo, width, height int) (Image, error)
- func (c *Converter) Files(args []string) ([]File, error)
- func (c *Converter) Meta(fileName string) (any, error)
- func (c *Converter) PageCount(fileName string, fileInfo os.FileInfo) (int, error)
- func (c *Converter) Preview(fileName string, fileInfo os.FileInfo, width, height int) (Image, error)
- func (c *Converter) PreviewPage(fileName string, fileInfo os.FileInfo, page, width, height int) (Image, error)
- func (c *Converter) Thumbnail(file File) error
- type File
- type Image
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Converter ¶ added in v1.0.4
type Converter struct {
// Options struct
Opts Options
// Current working directory
Workdir string
// Number of files
Nfiles int
// Index of the current file
CurrFile int
// Number of contents in archive/document
Ncontents int
// Index of current content
CurrContent int32
// Start function
OnStart func()
// Progress function
OnProgress func()
// Compress function
OnCompress func()
// Cancel function
OnCancel func()
// contains filtered or unexported fields
}
Converter type.
func (*Converter) Cancel ¶ added in v1.0.4
func (c *Converter) Cancel()
Cancel cancels the operation.
func (*Converter) Combine ¶ added in v1.2.0
Combine merges multiple comic books into a single archive.
func (*Converter) CoverPreview ¶ added in v1.2.0
func (c *Converter) CoverPreview(fileName string, fileInfo os.FileInfo, width, height int) (Image, error)
CoverPreview returns the cover fitted into width x height, skipping the output-codec round-trip.
func (*Converter) PageCount ¶ added in v1.2.0
PageCount returns the number of pages (images) in a comic file, document or directory.
func (*Converter) Preview ¶ added in v1.0.4
func (c *Converter) Preview(fileName string, fileInfo os.FileInfo, width, height int) (Image, error)
Preview returns the cover as an image preview.
type Options ¶
type Options struct {
// Image format, valid values are jpeg, png, tiff, bmp, webp, avif, jxl
Format string
// Archive format, valid values are zip, tar
Archive string
// ZIP compression level: -1 default, 0 store (no compression), 1-9 deflate (1 fastest, 9 smallest)
ZipLevel int
// JPEG image quality
Quality int
// Encoder speed/effort, format-specific: webp method 0-6, avif speed 0-10, jxl effort 1-10; -1 uses the format default
Effort int
// Combine all inputs into a single archive
Combine bool
// Lossless enables lossless compression (webp, avif, jxl), ignores quality
Lossless bool
// Image width
Width int
// Image height
Height int
// Best fit for required width and height
Fit bool
// Do not upscale images already smaller than the requested width/height
NoUpscale bool
// Document rendering resolution in DPI (PDF, EPUB, etc.); 0 uses the page's native resolution
DPI int
// 0=NearestNeighbor, 1=Box, 2=Linear, 3=MitchellNetravali, 4=CatmullRom, 5=Gaussian, 6=Lanczos
Filter int
// Do not convert the cover image
NoCover bool
// Do not convert images that have RGB colorspace
NoRGB bool
// Remove non-image files from the archive
NoNonImage bool
// Do not transform or convert images
NoConvert bool
// Add suffix to file baseNoExt
Suffix string
// Extract cover
Cover bool
// Extract cover thumbnail (freedesktop spec.)
Thumbnail bool
// CBZ metadata
Meta bool
// Version
Version bool
// ZIP comment
Comment bool
// ZIP comment body
CommentBody string
// Add file
FileAdd string
// Remove file
FileRemove string
// Output file
OutFile string
// Output directory
OutDir string
// Convert images to grayscale (monochromatic)
Grayscale bool
// Rotate images, valid values are 0, 90, 180, 270
Rotate int
// Adjust the brightness of the images, must be in the range (-100, 100)
Brightness int
// Adjust the contrast of the images, must be in the range (-100, 100)
Contrast int
// Process subdirectories recursively
Recursive bool
// Process only files larger than size (in MB)
Size int
// Hide console output
Quiet bool
}
Options type.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.