imageprocessor

package
v0.0.0-...-fedf337 Latest Latest
Warning

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

Go to latest
Published: May 31, 2017 License: MIT Imports: 7 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DuelOCRStratagy = func() *OCRRunner {
	multi := processorcommand.MultiOCRCommand{}
	multi = append(multi, processorcommand.NewMemeOCR())
	multi = append(multi, processorcommand.NewStandardOCR())

	return &OCRRunner{multi}
}
View Source
var EverythingStrategy = func(cfg *config.Configuration, file *uploadedfile.UploadedFile) (*ImageProcessor, error) {
	size, err := file.FileSize()
	if err != nil {
		return &ImageProcessor{}, err
	}

	processor := multiProcessType{}
	processor = append(processor, &ImageOrienter{})
	processor = append(processor, &CompressLosslessly{})
	processor = append(processor, &ExifStripper{})

	if size > cfg.MaxFileSize {
		processor = append(processor, &ImageScaler{cfg.MaxFileSize})
	}

	async := asyncProcessType{}

	async = append(async, DuelOCRStratagy())
	for _, t := range file.GetThumbs() {
		async = append(async, t)
	}

	if len(async) > 0 {
		processor = append(processor, async)
	}

	return &ImageProcessor{processor}, nil
}
View Source
var MemeOCRStratagy = func() *OCRRunner {
	return &OCRRunner{processorcommand.NewMemeOCR()}
}
View Source
var PassthroughStrategy = func(cfg *config.Configuration, file *uploadedfile.UploadedFile) (*ImageProcessor, error) {
	return &ImageProcessor{multiProcessType{}}, nil
}

Just do nothing to the file after it's uploaded...

View Source
var StandardOCRStratagy = func() *OCRRunner {
	return &OCRRunner{processorcommand.NewStandardOCR()}
}
View Source
var ThumbnailStrategy = func(cfg *config.Configuration, file *uploadedfile.UploadedFile) (*ImageProcessor, error) {
	processor := asyncProcessType{}
	for _, t := range file.GetThumbs() {
		processor = append(processor, t)
	}

	return &ImageProcessor{processor}, nil
}

Functions

This section is empty.

Types

type CompressLosslessly

type CompressLosslessly struct{}

func (*CompressLosslessly) Process

func (this *CompressLosslessly) Process(image *uploadedfile.UploadedFile) error

func (*CompressLosslessly) String

func (this *CompressLosslessly) String() string

type ExifStripper

type ExifStripper struct{}

func (*ExifStripper) Process

func (this *ExifStripper) Process(image *uploadedfile.UploadedFile) error

func (*ExifStripper) String

func (this *ExifStripper) String() string

type ImageOrienter

type ImageOrienter struct{}

func (*ImageOrienter) Process

func (this *ImageOrienter) Process(image *uploadedfile.UploadedFile) error

func (*ImageOrienter) String

func (this *ImageOrienter) String() string

type ImageProcessor

type ImageProcessor struct {
	// contains filtered or unexported fields
}

func (*ImageProcessor) Run

func (this *ImageProcessor) Run(image *uploadedfile.UploadedFile) error

type ImageScaler

type ImageScaler struct {
	// contains filtered or unexported fields
}

func (*ImageScaler) Process

func (this *ImageScaler) Process(image *uploadedfile.UploadedFile) error

func (*ImageScaler) String

func (this *ImageScaler) String() string

type OCRRunner

type OCRRunner struct {
	Command processorcommand.OCRCommand
}

func (*OCRRunner) Process

func (this *OCRRunner) Process(image *uploadedfile.UploadedFile) error

func (*OCRRunner) String

func (this *OCRRunner) String() string

type ProcessType

type ProcessType interface {
	Process(image *uploadedfile.UploadedFile) error
	String() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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