imageio

package module
v0.0.0-...-4aaf21e Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2016 License: MIT Imports: 19 Imported by: 0

README

go-imageio

Golang wraps for image IO read and write.

Usages
mp4 := NewMp4("test.mp4", &Options{})
	for i := 0; i < 100; i++ {
		err := mp4.WriteImage("camera.png")
		if err != nil {
			log.Printf(err)
		}
	}
Result

2016-10-19

System: Win 7 Memory: 8G CPU: Core(TM) i5-4570 3.20GHz

-- Write --
BenchmarkWriteJPEGImageFile                100          25.75 ms/op
BenchmarkWritePNGImageFile                  20          60.60 ms/op
BenchmarkWriteJPEGImage                    100          17.11 ms/op
BenchmarkWritePNGImage                     100          14.33 ms/op
-- Decode --
BenchmarkDecodeJPEGImage                   100          17.54 ms/op
BenchmarkDecodePNGImage                     20          57.90 ms/op

2016-10-19

Raspberry 2

-- Write --
BenchmarkWriteJPEGImageFile                  2         648 ms/op
BenchmarkWritePNGImageFile                   1        1271 ms/op
BenchmarkWriteJPEGImage                      3         436 ms/op
BenchmarkWritePNGImage                       3         400 ms/op
-- Decode --
BenchmarkDecodeJPEGImage                     2         510 ms/op
BenchmarkDecodePNGImage                      1        1229 ms/op
Reference
LICENSE

Under LICENSE MIT

Documentation

Index

Constants

View Source
const (
	RemoteResourceUrl = "https://github.com/imageio/imageio-binaries/raw/master/ffmpeg"
)

Variables

View Source
var (
	FnamePerPlatform = map[string]string{
		"osx32":   "ffmpeg.osx",
		"osx64":   "ffmpeg.osx",
		"win32":   "ffmpeg.win32.exe",
		"win64":   "ffmpeg.win32.exe",
		"linux32": "ffmpeg.linux32",
		"linux64": "ffmpeg.linux64",
	}
)

Functions

func CheckFFmpegVersion

func CheckFFmpegVersion(filepath string) (bool, error)

func CheckIfFFmpegInPATH

func CheckIfFFmpegInPATH() (bool, error)

Check if ffmpeg is in System PATH

func CheckIfFileExecutable

func CheckIfFileExecutable(filepath string) (bool, error)

Check if the exe file is excutable.

func GetFFmpegExe

func GetFFmpegExe() (string, error)

Ensure we have our version of the binary freeimage lib.

func GetPlatform

func GetPlatform() (platform string)

Get a string that specifies the platform more specific than The result can be: linux32, linux64, win32, win64, osx32, osx64. Other platforms may be added in the future.

func GetRomoteFile

func GetRomoteFile(fname string) error

Get a filename for the local version of a file from the web

func LoadImage

func LoadImage(path string) (image.Image, error)

Load image.

func LoadImageBitmap

func LoadImageBitmap(imgfile image.Image) []uint8

Load Image Bitmap.

Types

type Options

type Options struct {
	FPS         int
	Codec       string
	Pixelformat string
	Pixfmt      string
}

Mp4 video convert options.

type PassThru

type PassThru struct {
	io.Reader
	CurrentSize int // Current # of bytes transferred
	TotalSize   int // Total # of bytes transferred
}

The results from individual calls to it.

func (*PassThru) Read

func (pt *PassThru) Read(p []byte) (int, error)

Read 'overrides' the underlying io.Reader's Read method. This is the one that will be called by io.Copy(). We simply use it to keep track of byte counts and then forward the call.

type Video

type Video struct {
	Cmd       *exec.Cmd
	StdinWr   io.WriteCloser
	Dimension string
	ExePath   string
	Output    string
	Option    *Options
}

Video struct.

func NewVideo

func NewVideo(output string, op *Options) *Video

New Instance.

func (*Video) Close

func (this *Video) Close() error

Close ffmpeg

func (*Video) WriteImage

func (this *Video) WriteImage(image image.Image) error

Write image by image.Image

func (*Video) WriteImageFile

func (this *Video) WriteImageFile(imagePath string) error

Write image by file path.

Jump to

Keyboard shortcuts

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