jp2info

package
v2.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IHDR   = []byte{0x69, 0x68, 0x64, 0x72} // "ihdr"
	COLR   = []byte{0x63, 0x6f, 0x6c, 0x72} // "colr"
	SOCSIZ = []byte{0xFF, 0x4F, 0xFF, 0x51}
	COD    = []byte{0xFF, 0x52}
)

Various hard-coded byte values for finding JP2 boxes

View Source
var JP2HEADER = []byte{
	0x00, 0x00, 0x00, 0x0c,
	0x6a, 0x50, 0x20, 0x20,
	0x0d, 0x0a, 0x87, 0x0a,
}

JP2HEADER contains the raw bytes for the only JP2 header we currently respect

Functions

This section is empty.

Types

type ColorMethod

type ColorMethod uint8

ColorMethod tells us how to determine the colorspace

const (
	CMEnumerated    ColorMethod = 1
	CMRestrictedICC             = 2
)

Known color methods

type ColorSpace

type ColorSpace uint8

ColorSpace tells us how to parse color data coming from openjpeg

const (
	CSUnknown ColorSpace = iota
	CSRGB
	CSGrayScale
	CSYCC
)

Known color spaces

func (ColorSpace) String

func (cs ColorSpace) String() string

String reports the ColorSpace in a human-readable way

type Info

type Info struct {
	// Main header info
	Width, Height uint32
	Comps         uint16
	BPC           uint8

	// Color data
	ColorMethod  ColorMethod
	ColorSpace   ColorSpace
	Prec, Approx uint8

	// From SIZ box - this data can replace the main header data and
	// some of the colorspace data if necessary
	LSiz, RSiz     uint16
	XSiz, YSiz     uint32
	XOSiz, YOSiz   uint32
	XTSiz, YTSiz   uint32
	XTOSiz, YTOSiz uint32
	CSiz           uint16

	// From COD box
	LCod   uint16
	SCod   uint8
	SGCod  uint32
	Levels uint8
}

Info stores a variety of data we can easily scan from a jpeg2000 header

func (*Info) TileHeight

func (i *Info) TileHeight() uint32

TileHeight computes height of tiles

func (*Info) TileWidth

func (i *Info) TileWidth() uint32

TileWidth computes width of tiles

type Scanner

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

Scanner reads a Jpeg2000 header and parsing its data into an Info structure

func (*Scanner) Scan

func (s *Scanner) Scan(filename string) (*Info, error)

Scan reads the file and populates an Info pointer

Jump to

Keyboard shortcuts

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