Documentation
¶
Overview ¶
Package jpeg2000 provides JPEG 2000 encoding and decoding support.
Index ¶
Constants ¶
const ( MaxOutputSize = 512 << 20 // 512 MB maximum decoded output MaxImageWidth = 65535 // Maximum image dimension MaxImageHeight = 65535 MaxPixelCount = 256 << 20 // 256 megapixels MaxIterations = 1 << 20 // 1 million iterations per loop MaxTileCount = 65535 MaxDecompLevels = 32 )
Decoder constants for security limits
Variables ¶
var ( ErrInvalidCodestream = errors.New("invalid JPEG 2000 codestream") ErrMissingSOC = errors.New("missing SOC marker") ErrMissingSIZ = errors.New("missing SIZ marker") ErrMissingCOD = errors.New("missing COD marker") ErrMissingTileData = errors.New("missing tile data") ErrInvalidTileIndex = errors.New("invalid tile index") ErrOutputTooLarge = errors.New("output size exceeds maximum") ErrDimensionsTooLarge = errors.New("image dimensions exceed maximum") ErrTooManyTiles = errors.New("too many tiles") ErrDecodeFailed = errors.New("decode failed") ErrInvalidWaveletLevel = errors.New("invalid wavelet decomposition level") ErrTruncatedData = errors.New("truncated data") ErrInvalidQualityLayer = errors.New("invalid quality layer") ErrInvalidJP2Container = errors.New("invalid JP2 container") )
Decoder errors
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes JPEG 2000 codestreams
func NewDecoder ¶
NewDecoder creates a new JPEG 2000 decoder from raw codestream or JP2 container data
func (*Decoder) DecodeQualityLayers ¶
DecodeQualityLayers decodes up to the specified quality layer. Layer 0 is the base quality layer, higher layers add more detail. Passing maxLayer <= 0 decodes all available layers.
func (*Decoder) DecodeTile ¶
DecodeTile decodes a single tile and returns raw pixel data for that tile. This method is useful for streaming decode, allowing memory-efficient processing of large images by decoding one tile at a time.
The returned data is in interleaved format: for an RGB image, the data is organized as RGBRGBRGB... for each pixel in the tile, row by row.
func (*Decoder) GetNumLayers ¶
GetNumLayers returns the number of quality layers in the codestream
type ImageInfo ¶
type ImageInfo struct {
Width int // Image width in pixels
Height int // Image height in pixels
NumChannels int // Number of components
BitDepth int // Bits per sample (may vary per component)
Reversible bool // True if using 5/3 wavelet (lossless capable)
NumTilesX int // Number of tiles horizontally
NumTilesY int // Number of tiles vertically
TileWidth int // Nominal tile width
TileHeight int // Nominal tile height
DecompLevel int // Number of decomposition levels
NumLayers int // Number of quality layers
IsJP2 bool // True if source was JP2 container
IsHTJ2K bool // True if using High-Throughput block coding (Part 15)
}
ImageInfo contains decoded image metadata
Directories
¶
| Path | Synopsis |
|---|---|
|
Package htj2k implements HTJ2K block decoding.
|
Package htj2k implements HTJ2K block decoding. |
|
Package jp3d implements JPEG 2000 Part 10 (JP3D) volumetric image support as specified in ISO/IEC 15444-10.
|
Package jp3d implements JPEG 2000 Part 10 (JP3D) volumetric image support as specified in ISO/IEC 15444-10. |
|
Package jpip implements JPEG 2000 Part 9 (JPIP) client response parsing as specified in ISO/IEC 15444-9.
|
Package jpip implements JPEG 2000 Part 9 (JPIP) client response parsing as specified in ISO/IEC 15444-9. |
|
Package jpm provides JPEG 2000 Part 6 (JPM) compound image support per ISO/IEC 15444-6.
|
Package jpm provides JPEG 2000 Part 6 (JPM) compound image support per ISO/IEC 15444-6. |
|
Package jpsec implements JPEG 2000 Part 8 (JPSEC) security features as specified in ISO/IEC 15444-8.
|
Package jpsec implements JPEG 2000 Part 8 (JPSEC) security features as specified in ISO/IEC 15444-8. |
|
Package jpwl implements JPEG 2000 Part 11 (JPWL) wireless transmission support as specified in ISO/IEC 15444-11.
|
Package jpwl implements JPEG 2000 Part 11 (JPWL) wireless transmission support as specified in ISO/IEC 15444-11. |
|
Package jpx provides JPEG 2000 Part 2 (JPX) extended file format support.
|
Package jpx provides JPEG 2000 Part 2 (JPX) extended file format support. |
|
Package mct implements the Multi-Component Transform (MCT) defined by ISO/IEC 15444-1 §F.4.9 for JPEG 2000.
|
Package mct implements the Multi-Component Transform (MCT) defined by ISO/IEC 15444-1 §F.4.9 for JPEG 2000. |
|
Package mj2 implements Motion JPEG 2000 (MJ2/MJP2) per ISO/IEC 15444-3.
|
Package mj2 implements Motion JPEG 2000 (MJ2/MJP2) per ISO/IEC 15444-3. |
|
Package security provides security validation for JPEG 2000 parsing
|
Package security provides security validation for JPEG 2000 parsing |
|
Package trellis implements trellis quantization for JPEG 2000 Part 2 (JPX).
|
Package trellis implements trellis quantization for JPEG 2000 Part 2 (JPX). |