fastimage

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 2 Imported by: 0

README

fastimage - fastest image info

godoc release goreport coverage

Getting Started

try on https://play.golang.org/p/8yHaCknD1Rm

package main

import (
	"fmt"
	"github.com/phuslu/fastimage"
)

var data = []byte("RIFF,-\x00\x00WEBPVP8X\n\x00\x00\x00" +
    "\x10\x00\x00\x00\x8f\x01\x00,\x01\x00VP8X\n\x00\x00\x00\x10\xb2" +
    "\x01\x00\x00WEB\x01\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00" +
    "\x00WEB\x01\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00\x00W" +
    "EB\x01\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00\x00WEB" +
    "\x01\x00VP8X\n\x00\x00\x00\x10\x00\x90X\x00\x00WEB\x00" +
    "ALPHPVP8X\n\x00\x00\x00\x10\x00\x00\x00\x8f\x01\x00" +
    ",\x01\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00\x00WEB\x01" +
    "\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00\x00WE\u007f\x00\x00\x00" +
    "P893\n\x00\x00\x00\x10\xb2\x01\x00\x00WEB\x01\x00VP" +
    "8X\n\x00\x00\x00\x10\xb2\x01\x00\x00WEB\x01\x00VP8X" +
    "\n\x00\x00\x00")

func main() {
	fmt.Printf("%+v\n", fastimage.GetInfo(data))
}

// Output: {Type:webp Width:400 Height:301}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Type   Type
	Width  uint32
	Height uint32
}

func GetInfo

func GetInfo(p []byte) (info Info)

GetInfo return a image info of data.

type Type

type Type uint64
const (
	Unknown Type = iota
	BMP
	BPM
	GIF
	JPEG
	MNG
	PBM
	PCX
	PGM
	PNG
	PPM
	PSD
	RAS
	RGB
	TIFF
	WEBP
	XBM
	XPM
	XV
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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