jpeg

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 1 Imported by: 13

Documentation

Overview

Package jpeg contains utilities to work with the JPEG codec.

Index

Constants

View Source
const (
	MarkerStartOfImage            = 0xD8
	MarkerDefineQuantizationTable = 0xDB
	MarkerDefineHuffmanTable      = 0xC4
	MarkerDefineRestartInterval   = 0xDD
	MarkerStartOfFrame1           = 0xC0
	MarkerStartOfScan             = 0xDA
	MarkerEndOfImage              = 0xD9
	MarkerComment                 = 0xFE
)

standard JPEG markers.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefineHuffmanTable

type DefineHuffmanTable struct {
	Codes       []byte
	Symbols     []byte
	TableNumber int
	TableClass  int
}

DefineHuffmanTable is a DHT marker.

func (DefineHuffmanTable) Marshal

func (m DefineHuffmanTable) Marshal(buf []byte) []byte

Marshal encodes the marker.

type DefineQuantizationTable

type DefineQuantizationTable struct {
	Tables []QuantizationTable
}

DefineQuantizationTable is a DQT marker.

func (DefineQuantizationTable) Marshal

func (m DefineQuantizationTable) Marshal(buf []byte) []byte

Marshal encodes the marker.

func (*DefineQuantizationTable) Unmarshal

func (m *DefineQuantizationTable) Unmarshal(buf []byte) error

Unmarshal decodes the marker.

type DefineRestartInterval

type DefineRestartInterval struct {
	Interval uint16
}

DefineRestartInterval is a DRI marker.

func (*DefineRestartInterval) Unmarshal

func (m *DefineRestartInterval) Unmarshal(buf []byte) error

Unmarshal decodes the marker.

type QuantizationTable

type QuantizationTable struct {
	ID        uint8
	Precision uint8
	Data      []byte
}

QuantizationTable is a DQT quantization table.

type StartOfFrame1

type StartOfFrame1 struct {
	Type                   uint8
	Width                  int
	Height                 int
	QuantizationTableCount uint8 // write only
}

StartOfFrame1 is a SOF1 marker.

func (StartOfFrame1) Marshal

func (m StartOfFrame1) Marshal(buf []byte) []byte

Marshal encodes the marker.

func (*StartOfFrame1) Unmarshal

func (m *StartOfFrame1) Unmarshal(buf []byte) error

Unmarshal decodes the marker.

type StartOfImage

type StartOfImage struct{}

StartOfImage is a SOI marker.

func (StartOfImage) Marshal

func (StartOfImage) Marshal(buf []byte) []byte

Marshal encodes the marker.

type StartOfScan

type StartOfScan struct{}

StartOfScan is a SOS marker.

func (StartOfScan) Marshal

func (StartOfScan) Marshal(buf []byte) []byte

Marshal encodes the marker.

func (StartOfScan) Unmarshal

func (StartOfScan) Unmarshal(buf []byte) error

Unmarshal decodes the marker.

Jump to

Keyboard shortcuts

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