rgbe

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 9 Imported by: 11

README

RGBE - Radiance RGBE/XYZE

A RGBE codec for Golang.

Usage

package main

import (
	"image"
	"image/png"
	"os"

	_ "github.com/mdouchement/hdrimage/rgbe"
)

var (
	input  = "/tmp/IMG_0020.rgbe"
	output = "/tmp/IMG_0020.png"
)

func main() {
	fi, err := os.Open(input)
	check(err)
	defer fi.Close()

	m, _, err := image.Decode(fi)
	check(err)

	fo, err := os.Create(output)
	check(err)

	png.Encode(fo, m)
}

func check(err error) {
	if err != nil {
		panic(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RLEWrites = true

RLEWrites allows to write image file with run-length encoding.

Functions

func Decode

func Decode(r io.Reader) (img image.Image, err error)

Decode reads a HDR image from r and returns an image.Image.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

DecodeConfig returns the color model and dimensions of a RGBE image without decoding the entire image.

func Encode

func Encode(w io.Writer, m hdr.Image) error

Encode writes the Image m to w in RGBE format.

Types

type FormatError

type FormatError string

A FormatError reports that the input is not a valid RGBE image.

func (FormatError) Error

func (e FormatError) Error() string

type InternalError

type InternalError string

An InternalError reports that an internal error was encountered.

func (InternalError) Error

func (e InternalError) Error() string

type UnsupportedError

type UnsupportedError string

An UnsupportedError reports that the input uses a valid but unimplemented feature.

func (UnsupportedError) Error

func (e UnsupportedError) Error() string

Jump to

Keyboard shortcuts

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