tiffstructure

package module
v0.0.0-...-8ecc4f5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 8 Imported by: 0

README

Build Status Coverage Status Go Report Card GoDoc

Overview

Parse raw TIFF data.

Requirements

  • Go >= 1.17: Earlier versions may work, though testing broke before due to a "undefined: unsafe.Slice" error apparently in the basic flow of "go test".

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TiffMediaContext

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

TiffMediaContext encapsulates parsed EXIF data.

func (*TiffMediaContext) Exif

func (tmc *TiffMediaContext) Exif() (rootIfd *exif.Ifd, data []byte, err error)

Exif is an accessor that returns the root IFD.

type TiffMediaParser

type TiffMediaParser struct {
}

TiffMediaParser knows how to parse a TIFF stream.

func NewTiffMediaParser

func NewTiffMediaParser() *TiffMediaParser

NewTiffMediaParser returns a new `TiffMediaParser` struct.

func (*TiffMediaParser) LooksLikeFormat

func (tmp *TiffMediaParser) LooksLikeFormat(data []byte) bool

LooksLikeFormat returns a boolean indicating whether this looks like a TIFF stream.

Example
filepath := getTestExifImageFilepath()

data, err := ioutil.ReadFile(filepath)
log.PanicIf(err)

pmp := NewTiffMediaParser()

isPng := pmp.LooksLikeFormat(data)
fmt.Printf("%v\n", isPng)
Output:

true

func (*TiffMediaParser) Parse

func (tmp *TiffMediaParser) Parse(rs io.ReadSeeker, size int) (mc riimage.MediaContext, err error)

Parse parses a TIFF stream given a `io.ReadSeeker`.

func (*TiffMediaParser) ParseBytes

func (tmp *TiffMediaParser) ParseBytes(data []byte) (mc riimage.MediaContext, err error)

ParseBytes parses a TIFF stream given a byte-slice.

func (*TiffMediaParser) ParseFile

func (tmp *TiffMediaParser) ParseFile(filepath string) (mc riimage.MediaContext, err error)

ParseFile parses a TIFF stream given a file-path.

Jump to

Keyboard shortcuts

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