preview

package module
v0.0.0-...-9bc3462 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 12 Imported by: 1

README

License GoDoc Go Report Card CircleCI

Preview

🎨 Simple cross platform image viewing for developers

Installing

You can fetch this library by running the following

go get -u github.com/joshdk/preview

Usage

import (
	"image/jpeg"
	"net/http"
	"github.com/joshdk/preview"
)

resp, err := http.Get("https://i.imgur.com/X9GB4Pu.jpg")
if err != nil {
	panic(err.Error())
}

img, err := jpeg.Decode(resp.Body)
if err != nil {
	panic(err.Error())
}

preview.Image(img)

If run on a Mac, this code will open up the Preview utility, displaying the downloaded image. On Linux, the display or xv utility is used.

Previewing of the following types are supported:

License

This library is distributed under the MIT License, see LICENSE.txt for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Color

func Color(clr color.Color) error

Color will open a viewer for the color.Color specified by clr. The previewed image will be 256x256 pixels in size, completely filled with the given color.

func Colors

func Colors(clrs []color.Color) error

Colors will open a viewer for the color.Color slice specified by clrs. The previewed image will be at least 256x256 pixels in size, filled with vertical stripes of equal width.

func File

func File(filename string) error

File will open a viewer for the path specified by filename.

func Glot

func Glot(plt *glot.Plot) error

Glot will open a viewer for the glot.Plot specified by plt.

func Gonum

func Gonum(plt *plot.Plot) error

Gonum will open a viewer for the plot.Plot specified by plt. The previewed image will be 4x4 inches in size.

func Image

func Image(img image.Image) error

Image will open a viewer for the image.Image specified by img.

func Show

func Show(any interface{}) error

Show will open a viewer for the type specified by any.

Types

This section is empty.

Jump to

Keyboard shortcuts

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