Documentation
¶
Overview ¶
* Go interface to libheif * * Copyright (c) 2018-2024 struktur AG, Joachim Bauch <bauch@struktur.de> * * libheif is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * libheif is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with libheif. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- func GetVersion() string
- func HaveDecoderForFormat(format CompressionFormat) bool
- func HaveEncoderForFormat(format CompressionFormat) bool
- type Channel
- type Chroma
- type ChromaDownsamplingAlgorithm
- type ChromaUpsamplingAlgorithm
- type Colorspace
- type CompressionFormat
- type Context
- func (c *Context) GetImageHandle(id int) (*ImageHandle, error)
- func (c *Context) GetListOfTopLevelImageIDs() []int
- func (c *Context) GetNumberOfTopLevelImages() int
- func (c *Context) GetPrimaryImageHandle() (*ImageHandle, error)
- func (c *Context) GetPrimaryImageID() (int, error)
- func (c *Context) IsTopLevelImageID(ID int) bool
- func (c *Context) NewEncoder(compression CompressionFormat) (*Encoder, error)
- func (c *Context) ReadFromFile(filename string) error
- func (c *Context) ReadFromMemory(data []byte) error
- func (c *Context) Write(w io.Writer) error
- func (c *Context) WriteToFile(filename string) error
- type DecodingOptions
- func (o *DecodingOptions) GetChromaDownsamplingAlgorithm() ChromaDownsamplingAlgorithm
- func (o *DecodingOptions) GetChromaUpsamplingAlgorithm() ChromaUpsamplingAlgorithm
- func (o *DecodingOptions) GetConvertHDRTo8Bit() bool
- func (o *DecodingOptions) GetDecoderId() string
- func (o *DecodingOptions) GetIgnoreTransformations() bool
- func (o *DecodingOptions) GetOnlyUsePreferredChromaAlgorithm() bool
- func (o *DecodingOptions) GetStrictDecoding() bool
- func (o *DecodingOptions) SetChromaDownsamplingAlgorithm(algorithm ChromaDownsamplingAlgorithm)
- func (o *DecodingOptions) SetChromaUpsamplingAlgorithm(algorithm ChromaUpsamplingAlgorithm)
- func (o *DecodingOptions) SetConvertHDRTo8Bit(convert bool)
- func (o *DecodingOptions) SetDecoderId(decoder string)
- func (o *DecodingOptions) SetIgnoreTransformations(ignore bool)
- func (o *DecodingOptions) SetOnlyUsePreferredChromaAlgorithm(preferred bool)
- func (o *DecodingOptions) SetStrictDecoding(strict bool)
- type Encoder
- func (e *Encoder) GetParameter(name string) (string, error)
- func (e *Encoder) GetParameterBool(name string) (bool, error)
- func (e *Encoder) GetParameterInteger(name string) (int, error)
- func (e *Encoder) GetParameterString(name string) (string, error)
- func (e *Encoder) HasDefault(name string) bool
- func (e *Encoder) ID() string
- func (e *Encoder) ListParameters() []EncoderParameter
- func (e *Encoder) Name() string
- func (e *Encoder) SetLoggingLevel(l LoggingLevel) error
- func (e *Encoder) SetLossless(l LosslessMode) error
- func (e *Encoder) SetParameter(name string, value string) error
- func (e *Encoder) SetParameterBool(name string, value bool) error
- func (e *Encoder) SetParameterInteger(name string, value int) error
- func (e *Encoder) SetParameterString(name string, value string) error
- func (e *Encoder) SetQuality(q int) error
- type EncoderParameter
- type EncoderParameterSetter
- func SetEncoderLoggingLevel(level LoggingLevel) EncoderParameterSetter
- func SetEncoderLossless(lossless LosslessMode) EncoderParameterSetter
- func SetEncoderParameter(name string, value string) EncoderParameterSetter
- func SetEncoderParameterBool(name string, value bool) EncoderParameterSetter
- func SetEncoderParameterInteger(name string, value int) EncoderParameterSetter
- func SetEncoderParameterString(name string, value string) EncoderParameterSetter
- func SetEncoderQuality(quality int) EncoderParameterSetter
- type EncoderParameterType
- type EncodingOptions
- type ErrorCode
- type HeifError
- type Image
- func (img *Image) GetBitsPerPixel(channel Channel) int
- func (img *Image) GetBitsPerPixelRange(channel Channel) int
- func (img *Image) GetChromaFormat() Chroma
- func (img *Image) GetColorspace() Colorspace
- func (img *Image) GetHeight(channel Channel) int
- func (img *Image) GetImage() (image.Image, error)
- func (img *Image) GetPlane(channel Channel) (*ImageAccess, error)
- func (img *Image) GetWidth(channel Channel) int
- func (img *Image) NewPlane(channel Channel, width, height, depth int) (*ImageAccess, error)
- func (img *Image) ScaleImage(width int, height int) (*Image, error)
- type ImageAccess
- type ImageHandle
- func (h *ImageHandle) DecodeImage(colorspace Colorspace, chroma Chroma, options *DecodingOptions) (*Image, error)
- func (h *ImageHandle) GetDepthImageHandle(depth_image_id int) (*ImageHandle, error)
- func (h *ImageHandle) GetHeight() int
- func (h *ImageHandle) GetListOfDepthImageIDs() []int
- func (h *ImageHandle) GetListOfThumbnailIDs() []int
- func (h *ImageHandle) GetNumberOfDepthImages() int
- func (h *ImageHandle) GetNumberOfThumbnails() int
- func (h *ImageHandle) GetThumbnail(thumbnail_id int) (*ImageHandle, error)
- func (h *ImageHandle) GetWidth() int
- func (h *ImageHandle) HasAlphaChannel() bool
- func (h *ImageHandle) HasDepthImage() bool
- func (h *ImageHandle) IsPrimaryImage() bool
- type LoggingLevel
- type LosslessMode
- type ProgressStep
- type SuberrorCode
Constants ¶
const ( // ChromaInterleaved24Bit is an alias for ChromaInterleavedRGB. // // Deprecated: use ChromaInterleavedRGB instead ChromaInterleaved24Bit = ChromaInterleavedRGB // ChromaInterleaved32Bit is an alias for ChromaInterleavedRGBA // // Deprecated: use ChromaInterleavedRGBA instead ChromaInterleaved32Bit = ChromaInterleavedRGBA )
Variables ¶
This section is empty.
Functions ¶
func HaveDecoderForFormat ¶
func HaveDecoderForFormat(format CompressionFormat) bool
HaveDecoderForFormat checks if a decoder is available for the given format. Note that the decoder still may not be able to decode all variants of that format. You will have to query that further or just try to decode and check the returned error.
func HaveEncoderForFormat ¶
func HaveEncoderForFormat(format CompressionFormat) bool
HaveEncoderForFormat checks if an encoder is available for the given format. Note that the encoder may be limited to a certain subset of features (e.g. only 8 bit, only lossy). You will have to query the specific capabilities further.
Types ¶
type Channel ¶
type Channel C.enum_heif_channel
const ( ChannelY Channel = C.heif_channel_Y ChannelCb Channel = C.heif_channel_Cb ChannelCr Channel = C.heif_channel_Cr ChannelR Channel = C.heif_channel_R ChannelG Channel = C.heif_channel_G ChannelB Channel = C.heif_channel_B ChannelAlpha Channel = C.heif_channel_Alpha ChannelInterleaved Channel = C.heif_channel_interleaved )
type Chroma ¶
type Chroma C.enum_heif_chroma
const ( ChromaUndefined Chroma = C.heif_chroma_undefined ChromaMonochrome Chroma = C.heif_chroma_monochrome Chroma420 Chroma = C.heif_chroma_420 Chroma422 Chroma = C.heif_chroma_422 Chroma444 Chroma = C.heif_chroma_444 ChromaInterleavedRGB Chroma = C.heif_chroma_interleaved_RGB ChromaInterleavedRGBA Chroma = C.heif_chroma_interleaved_RGBA // HDR, big endian. ChromaInterleavedRRGGBB_BE Chroma = C.heif_chroma_interleaved_RRGGBB_BE // HDR, big endian. ChromaInterleavedRRGGBBAA_BE Chroma = C.heif_chroma_interleaved_RRGGBBAA_BE // HDR, little endian. ChromaInterleavedRRGGBB_LE Chroma = C.heif_chroma_interleaved_RRGGBB_LE // HDR, little endian. ChromaInterleavedRRGGBBAA_LE Chroma = C.heif_chroma_interleaved_RRGGBBAA_LE )
type ChromaDownsamplingAlgorithm ¶
type ChromaDownsamplingAlgorithm C.enum_heif_chroma_downsampling_algorithm
const ( ChromaDownsamplingNearestNeighbor ChromaDownsamplingAlgorithm = C.heif_chroma_downsampling_nearest_neighbor ChromaDownsamplingAverage ChromaDownsamplingAlgorithm = C.heif_chroma_downsampling_average // Combine with 'heif_chroma_upsampling_bilinear' for best quality. // Makes edges look sharper when using YUV 420 with bilinear chroma upsampling. ChromaDownsamplingSharpYuv ChromaDownsamplingAlgorithm = C.heif_chroma_downsampling_sharp_yuv )
type ChromaUpsamplingAlgorithm ¶
type ChromaUpsamplingAlgorithm C.enum_heif_chroma_upsampling_algorithm
const ( ChromaUpsamplingNearestNeighbor ChromaUpsamplingAlgorithm = C.heif_chroma_upsampling_nearest_neighbor ChromaUpsamplingBilinear ChromaUpsamplingAlgorithm = C.heif_chroma_upsampling_bilinear )
type Colorspace ¶
type Colorspace C.enum_heif_colorspace
const ( ColorspaceUndefined Colorspace = C.heif_colorspace_undefined // heif_colorspace_YCbCr should be used with one of these heif_chroma values: // * heif_chroma_444 // * heif_chroma_422 // * heif_chroma_420 ColorspaceYCbCr Colorspace = C.heif_colorspace_YCbCr // heif_colorspace_RGB should be used with one of these heif_chroma values: // * heif_chroma_444 (for planar RGB) // * heif_chroma_interleaved_RGB // * heif_chroma_interleaved_RGBA // * heif_chroma_interleaved_RRGGBB_BE // * heif_chroma_interleaved_RRGGBBAA_BE // * heif_chroma_interleaved_RRGGBB_LE // * heif_chroma_interleaved_RRGGBBAA_LE ColorspaceRGB Colorspace = C.heif_colorspace_RGB // heif_colorspace_monochrome should only be used with heif_chroma = heif_chroma_monochrome ColorspaceMonochrome Colorspace = C.heif_colorspace_monochrome )
type CompressionFormat ¶
type CompressionFormat C.enum_heif_compression_format
const ( CompressionUndefined CompressionFormat = C.heif_compression_undefined CompressionHEVC CompressionFormat = C.heif_compression_HEVC CompressionAVC CompressionFormat = C.heif_compression_AVC CompressionJPEG CompressionFormat = C.heif_compression_JPEG CompressionAV1 CompressionFormat = C.heif_compression_AV1 CompressionVVC CompressionFormat = C.heif_compression_VVC CompressionEVC CompressionFormat = C.heif_compression_EVC // ISO/IEC 15444-16:2021 CompressionJPEG2000 CompressionFormat = C.heif_compression_JPEG2000 // ISO/IEC 23001-17:2023 CompressionUncompressed CompressionFormat = C.heif_compression_uncompressed )
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is a libheif context.
func EncodeFromImage ¶
func EncodeFromImage(img image.Image, compression CompressionFormat, params ...EncoderParameterSetter) (*Context, error)
EncodeFromImage is a high-level function to encode a Go Image to a new Context.
func NewContext ¶
NewContext creates a new libheif context that can be used for decoding and encoding of images.
func (*Context) GetImageHandle ¶
func (c *Context) GetImageHandle(id int) (*ImageHandle, error)
GetImageHandle returns the image handle of the given image id.
func (*Context) GetListOfTopLevelImageIDs ¶
GetListOfTopLevelImageIDs returns a list of top-level image ids.
func (*Context) GetNumberOfTopLevelImages ¶
GetNumberOfTopLevelImages returns the number of top-level images.
func (*Context) GetPrimaryImageHandle ¶
func (c *Context) GetPrimaryImageHandle() (*ImageHandle, error)
GetPrimaryImageHandle returns the image handle of the primary image.
func (*Context) GetPrimaryImageID ¶
GetPrimaryImageID returns the id of the primary image.
func (*Context) IsTopLevelImageID ¶
IsTopLevelImageID checks if a given id is a top-level image.
func (*Context) NewEncoder ¶
func (c *Context) NewEncoder(compression CompressionFormat) (*Encoder, error)
NewEncoder creates a new encoder with the given compression format.
func (*Context) ReadFromFile ¶
ReadFromFile loads the image from the given filename in the current context.
func (*Context) ReadFromMemory ¶
ReadFromMemory loads the image from the given data in the current context.
func (*Context) WriteToFile ¶
WriteToFile saves the current image to the given file.
type DecodingOptions ¶
type DecodingOptions struct {
// contains filtered or unexported fields
}
DecodingOptions contain options that are used for decoding.
func NewDecodingOptions ¶
func NewDecodingOptions() (*DecodingOptions, error)
NewDecodingOptions creates new decoding options.
func (*DecodingOptions) GetChromaDownsamplingAlgorithm ¶
func (o *DecodingOptions) GetChromaDownsamplingAlgorithm() ChromaDownsamplingAlgorithm
GetChromaDownsamplingAlgorithm returns the chroma downsampling algorithm to use.
func (*DecodingOptions) GetChromaUpsamplingAlgorithm ¶
func (o *DecodingOptions) GetChromaUpsamplingAlgorithm() ChromaUpsamplingAlgorithm
GetChromaUpsamplingAlgorithm returns the chroma upsampling algorithm to use.
func (*DecodingOptions) GetConvertHDRTo8Bit ¶
func (o *DecodingOptions) GetConvertHDRTo8Bit() bool
GetConvertHDRTo8Bit returns true if HDR images will be converted to 8bit during decoding.
func (*DecodingOptions) GetDecoderId ¶
func (o *DecodingOptions) GetDecoderId() string
GetDecoderId returns the decoder id that should be used.
func (*DecodingOptions) GetIgnoreTransformations ¶
func (o *DecodingOptions) GetIgnoreTransformations() bool
GetIgnoreTransformations returns true if geometric transformations like cropping, rotation, mirroring should be ignored.
func (*DecodingOptions) GetOnlyUsePreferredChromaAlgorithm ¶
func (o *DecodingOptions) GetOnlyUsePreferredChromaAlgorithm() bool
GetOnlyUsePreferredChromaAlgorithm returns true if only the preferred chroma algorithm should be used
func (*DecodingOptions) GetStrictDecoding ¶
func (o *DecodingOptions) GetStrictDecoding() bool
GetStrictDecoding returns true if strict decoding is enabled.
func (*DecodingOptions) SetChromaDownsamplingAlgorithm ¶
func (o *DecodingOptions) SetChromaDownsamplingAlgorithm(algorithm ChromaDownsamplingAlgorithm)
SetChromaDownsamplingAlgorithm sets the chroma downsampling algorithm to use.
func (*DecodingOptions) SetChromaUpsamplingAlgorithm ¶
func (o *DecodingOptions) SetChromaUpsamplingAlgorithm(algorithm ChromaUpsamplingAlgorithm)
SetChromaUpsamplingAlgorithm sets the chroma upsampling algorithm to use.
func (*DecodingOptions) SetConvertHDRTo8Bit ¶
func (o *DecodingOptions) SetConvertHDRTo8Bit(convert bool)
SetConvertHDRTo8Bit defines whether HDR images should be converted to 8bit during decoding.
func (*DecodingOptions) SetDecoderId ¶
func (o *DecodingOptions) SetDecoderId(decoder string)
SetDecoderId sets the id of the decoder to use. If an empty id is specified (the default), the highest priority decoder is chosen. The priority is defined in the plugin.
func (*DecodingOptions) SetIgnoreTransformations ¶
func (o *DecodingOptions) SetIgnoreTransformations(ignore bool)
SetIgnoreTransformations sets whether geometric transformations like cropping, rotation, mirroring should be ignored.
func (*DecodingOptions) SetOnlyUsePreferredChromaAlgorithm ¶
func (o *DecodingOptions) SetOnlyUsePreferredChromaAlgorithm(preferred bool)
SetOnlyUsePreferredChromaAlgorithm enforces to use the preferred algorithm. If set to false, libheif may also use a different algorithm if the preferred one is not available.
func (*DecodingOptions) SetStrictDecoding ¶
func (o *DecodingOptions) SetStrictDecoding(strict bool)
SetStrictDecoding enabled strict decoding and an error is returned for invalid input. Otherwise, it will try its best and add decoding warnings to the decoded heif_image. Default is non-strict.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder contains a libheif encoder object.
func (*Encoder) GetParameter ¶
GetParameter returns the current value of a parameter of any type as a human readable string. The returned string is compatible with SetParameter().
func (*Encoder) GetParameterBool ¶
GetParameterBool returns the value of the boolean parameter.
func (*Encoder) GetParameterInteger ¶
GetParameterInteger returns the value of the integer parameter.
func (*Encoder) GetParameterString ¶
GetParameterString returns the value of the string parameter.
func (*Encoder) HasDefault ¶
HasDefault returns true if a parameter has a default value.
func (*Encoder) ListParameters ¶
func (e *Encoder) ListParameters() []EncoderParameter
ListParameters returns a list of parameters this encoder supports.
func (*Encoder) SetLoggingLevel ¶
func (e *Encoder) SetLoggingLevel(l LoggingLevel) error
SetLoggingLevel sets the logging level to use for encoding.
func (*Encoder) SetLossless ¶
func (e *Encoder) SetLossless(l LosslessMode) error
SetLossless enables or disables the lossless encoding mode.
func (*Encoder) SetParameter ¶
SetParameter sets a parameter of any type to the string value. Integer values are parsed from the string. Boolean values can be "true", "false", "1", "0".
x265 encoder specific note: When using the x265 encoder, you may pass any of its parameters by prefixing the parameter name with 'x265:'. Hence, to set the 'ctu' parameter, you will have to set 'x265:ctu' in libheif. Note that there is no checking for valid parameters when using the prefix.
func (*Encoder) SetParameterBool ¶
SetParameterBool sets the boolean parameter.
func (*Encoder) SetParameterInteger ¶
SetParameterInteger sets the integer parameter.
func (*Encoder) SetParameterString ¶
SetParameterString sets the string parameter.
func (*Encoder) SetQuality ¶
SetQuality sets the quality level for the encoder.
type EncoderParameter ¶
type EncoderParameter struct {
// contains filtered or unexported fields
}
EncoderParameter defines a parameter that can be set on an encoder.
func (EncoderParameter) IntegerValues ¶
func (p EncoderParameter) IntegerValues() (*int, *int, []int, error)
IntegerValues returns the minimum and maximum values (if present) or a list of allowed values (if defined).
func (EncoderParameter) Name ¶
func (p EncoderParameter) Name() string
Name returns the name of the encoder parameter.
func (EncoderParameter) String ¶
func (p EncoderParameter) String() string
String returns information on the encoder parameter.
func (EncoderParameter) StringValues ¶
func (p EncoderParameter) StringValues() ([]string, error)
StringValues returns a list of allowed values (if defined).
func (EncoderParameter) Type ¶
func (p EncoderParameter) Type() EncoderParameterType
Type returns the type of the encoder parameter.
type EncoderParameterSetter ¶
EncoderParameterSetter is a function that can configure an encoder.
func SetEncoderLoggingLevel ¶
func SetEncoderLoggingLevel(level LoggingLevel) EncoderParameterSetter
SetEncoderLoggingLevel returns a function that sets the logging level of an encoder.
func SetEncoderLossless ¶
func SetEncoderLossless(lossless LosslessMode) EncoderParameterSetter
SetEncoderLossless returns a function that sets the lossless mode of an encoder.
func SetEncoderParameter ¶
func SetEncoderParameter(name string, value string) EncoderParameterSetter
SetEncoderParameter returns a function that sets an arbitrary parameter in an encoder.
func SetEncoderParameterBool ¶
func SetEncoderParameterBool(name string, value bool) EncoderParameterSetter
SetEncoderParameterBool returns a function that sets a boolean parameter in an encoder.
func SetEncoderParameterInteger ¶
func SetEncoderParameterInteger(name string, value int) EncoderParameterSetter
SetEncoderParameterInteger returns a function that sets an integer parameter in an encoder.
func SetEncoderParameterString ¶
func SetEncoderParameterString(name string, value string) EncoderParameterSetter
SetEncoderParameterString returns a function that sets a string parameter in an encoder.
func SetEncoderQuality ¶
func SetEncoderQuality(quality int) EncoderParameterSetter
SetEncoderQuality returns a function that sets the quality of an encoder.
type EncoderParameterType ¶
type EncoderParameterType C.enum_heif_encoder_parameter_type
const ( EncoderParameterTypeInteger EncoderParameterType = C.heif_encoder_parameter_type_integer EncoderParameterTypeBoolean EncoderParameterType = C.heif_encoder_parameter_type_boolean EncoderParameterTypeString EncoderParameterType = C.heif_encoder_parameter_type_string )
type EncodingOptions ¶
type EncodingOptions struct {
// contains filtered or unexported fields
}
EncodingOptions contain options that are used for encoding images.
func NewEncodingOptions ¶
func NewEncodingOptions() (*EncodingOptions, error)
type ErrorCode ¶
type ErrorCode C.enum_heif_error_code
const ( // Everything ok, no error occurred. ErrorOK ErrorCode = C.heif_error_Ok // Input file does not exist. ErrorInputDoesNotExist ErrorCode = C.heif_error_Input_does_not_exist // Error in input file. Corrupted or invalid content. ErrorInvalidInput ErrorCode = C.heif_error_Invalid_input // Input file type is not supported. ErrorUnsupportedFiletype ErrorCode = C.heif_error_Unsupported_filetype // Image requires an unsupported decoder feature. ErrorUnsupportedFeature ErrorCode = C.heif_error_Unsupported_feature // Library API has been used in an invalid way. ErrorUsage ErrorCode = C.heif_error_Usage_error // Could not allocate enough memory. ErrorMemoryAllocation ErrorCode = C.heif_error_Memory_allocation_error // The decoder plugin generated an error ErrorDecoderPlugin ErrorCode = C.heif_error_Decoder_plugin_error // The encoder plugin generated an error ErrorEncoderPlugin ErrorCode = C.heif_error_Encoder_plugin_error // Error during encoding or when writing to the output ErrorEncoding ErrorCode = C.heif_error_Encoding_error // Application has asked for a color profile type that does not exist ErrorColorProfileDoesNotExist ErrorCode = C.heif_error_Color_profile_does_not_exist // Error loading a dynamic plugin ErrorPluginLoading ErrorCode = C.heif_error_Plugin_loading_error )
type HeifError ¶
type HeifError struct { Code ErrorCode Subcode SuberrorCode Message string }
HeifError contains information about an error in libheif.
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image contains information on a libheif image. It is either returned when decoding images or can be creates to encode an image using libheif.
func NewImage ¶
func NewImage(width, height int, colorspace Colorspace, chroma Chroma) (*Image, error)
NewImage creates a new image to be used by libheif.
func (*Image) GetBitsPerPixel ¶
GetBitsPerPixel returns the bits per pixel of the given channel of the image. Note that this is the number of bits used for storage of each pixel. Especially for HDR images this is probably not what you want, use "GetBitsPerPixelRange" instead.
func (*Image) GetBitsPerPixelRange ¶
GetBitsPerPixelRange returns the bits per pixel given channel of the image. This is the number of bits used for representing the pixel value, i.e. it will return "12" for 12bit HDR images (instead of "16" which would be the amount of bits used for storage).
func (*Image) GetChromaFormat ¶
GetChromaFormat returns the chroma format of the image.
func (*Image) GetColorspace ¶
func (img *Image) GetColorspace() Colorspace
GetColorspace returns the colorspace of the image.
func (*Image) GetPlane ¶
func (img *Image) GetPlane(channel Channel) (*ImageAccess, error)
GetPlane returns an ImageAccess object that can be used to access the raw pixel values of the given channel.
type ImageAccess ¶
ImageAccess contains information on how to access raw image data.
type ImageHandle ¶
type ImageHandle struct {
// contains filtered or unexported fields
}
ImageHandle contains information about an image in a libheif Context.
func (*ImageHandle) DecodeImage ¶
func (h *ImageHandle) DecodeImage(colorspace Colorspace, chroma Chroma, options *DecodingOptions) (*Image, error)
DecodeImage decodes the image to the provided colorspace and chroma.
func (*ImageHandle) GetDepthImageHandle ¶
func (h *ImageHandle) GetDepthImageHandle(depth_image_id int) (*ImageHandle, error)
GetDepthImageHandle returns the image handle for the given depth image id.
func (*ImageHandle) GetHeight ¶
func (h *ImageHandle) GetHeight() int
GetHeight returns the height of the image handle.
func (*ImageHandle) GetListOfDepthImageIDs ¶
func (h *ImageHandle) GetListOfDepthImageIDs() []int
GetListOfDepthImageIDs returns the list of depth image ids in the image handle.
func (*ImageHandle) GetListOfThumbnailIDs ¶
func (h *ImageHandle) GetListOfThumbnailIDs() []int
GetListOfThumbnailIDs returns the list of thumbnail ids in the image handle.
func (*ImageHandle) GetNumberOfDepthImages ¶
func (h *ImageHandle) GetNumberOfDepthImages() int
GetNumberOfDepthImages returns the number of depth images in the image handle.
func (*ImageHandle) GetNumberOfThumbnails ¶
func (h *ImageHandle) GetNumberOfThumbnails() int
GetNumberOfThumbnails returns the number of thumbnails in the image handle.
func (*ImageHandle) GetThumbnail ¶
func (h *ImageHandle) GetThumbnail(thumbnail_id int) (*ImageHandle, error)
GetThumbnail returns the image handle for the given thumbnail id.
func (*ImageHandle) GetWidth ¶
func (h *ImageHandle) GetWidth() int
GetWidth returns the width of the image handle.
func (*ImageHandle) HasAlphaChannel ¶
func (h *ImageHandle) HasAlphaChannel() bool
HasAlphaChannel checks if the image handle has an alpha channel.
func (*ImageHandle) HasDepthImage ¶
func (h *ImageHandle) HasDepthImage() bool
HasDepthImage checks if the image handle has a depth channel.
func (*ImageHandle) IsPrimaryImage ¶
func (h *ImageHandle) IsPrimaryImage() bool
IsPrimaryImage checks if the image handle is for a primary image.
type LoggingLevel ¶
type LoggingLevel int
const ( LoggingLevelNone LoggingLevel = iota LoggingLevelBasic LoggingLevelAdvanced LoggingLevelFull )
type LosslessMode ¶
type LosslessMode int
const ( LosslessModeDisabled LosslessMode = iota LosslessModeEnabled )
type ProgressStep ¶
type ProgressStep C.enum_heif_progress_step
const ( ProgressStepTotal ProgressStep = C.heif_progress_step_total ProgressStepLoadTile ProgressStep = C.heif_progress_step_load_tile )
type SuberrorCode ¶
type SuberrorCode C.enum_heif_suberror_code
const ( // no further information available SuberrorUnspecified SuberrorCode = C.heif_suberror_Unspecified // End of data reached unexpectedly. SuberrorEndOfData SuberrorCode = C.heif_suberror_End_of_data // Size of box (defined in header) is wrong SuberrorInvalidBoxSize SuberrorCode = C.heif_suberror_Invalid_box_size // Mandatory 'ftyp' box is missing SuberrorNoFtypBox SuberrorCode = C.heif_suberror_No_ftyp_box SuberrorNoIdatBox SuberrorCode = C.heif_suberror_No_idat_box SuberrorNoMetaBox SuberrorCode = C.heif_suberror_No_meta_box SuberrorNoHdlrBox SuberrorCode = C.heif_suberror_No_hdlr_box SuberrorNoHvcCBox SuberrorCode = C.heif_suberror_No_hvcC_box SuberrorNoPitmBox SuberrorCode = C.heif_suberror_No_pitm_box SuberrorNoIpcoBox SuberrorCode = C.heif_suberror_No_ipco_box SuberrorNoIpmaBox SuberrorCode = C.heif_suberror_No_ipma_box SuberrorNoIlocBox SuberrorCode = C.heif_suberror_No_iloc_box SuberrorNoIinfBox SuberrorCode = C.heif_suberror_No_iinf_box SuberrorNoIprpBox SuberrorCode = C.heif_suberror_No_iprp_box SuberrorNoIrefBox SuberrorCode = C.heif_suberror_No_iref_box SuberrorNoPictHandler SuberrorCode = C.heif_suberror_No_pict_handler // An item property referenced in the 'ipma' box is not existing in the 'ipco' container. SuberrorIpmaBoxReferencesNonexistingProperty SuberrorCode = C.heif_suberror_Ipma_box_references_nonexisting_property // No properties have been assigned to an item. SuberrorNoPropertiesAssignedToItem SuberrorCode = C.heif_suberror_No_properties_assigned_to_item // Image has no (compressed) data SuberrorNoItemData SuberrorCode = C.heif_suberror_No_item_data // Invalid specification of image grid (tiled image) SuberrorInvalidGridData SuberrorCode = C.heif_suberror_Invalid_grid_data // Tile-images in a grid image are missing SuberrorMissingGridImages SuberrorCode = C.heif_suberror_Missing_grid_images SuberrorInvalidCleanAperture SuberrorCode = C.heif_suberror_Invalid_clean_aperture // Invalid specification of overlay image SuberrorInvalidOverlayData SuberrorCode = C.heif_suberror_Invalid_overlay_data // Overlay image completely outside of visible canvas area SuberrorOverlayImageOutsideOfCanvas SuberrorCode = C.heif_suberror_Overlay_image_outside_of_canvas SuberrorAuxiliaryImageTypeUnspecified SuberrorCode = C.heif_suberror_Auxiliary_image_type_unspecified SuberrorNoOrInvalidPrimaryItem SuberrorCode = C.heif_suberror_No_or_invalid_primary_item SuberrorNoInfeBox SuberrorCode = C.heif_suberror_No_infe_box SuberrorUnknownColorProfileType SuberrorCode = C.heif_suberror_Unknown_color_profile_type SuberrorWrongTileImageChromaFormat SuberrorCode = C.heif_suberror_Wrong_tile_image_chroma_format SuberrorInvalidFractionalNumber SuberrorCode = C.heif_suberror_Invalid_fractional_number SuberrorInvalidImageSize SuberrorCode = C.heif_suberror_Invalid_image_size SuberrorInvalidPixiBox SuberrorCode = C.heif_suberror_Invalid_pixi_box SuberrorNoAV1CBox SuberrorCode = C.heif_suberror_No_av1C_box SuberrorWrongTileImagePixelDepth SuberrorCode = C.heif_suberror_Wrong_tile_image_pixel_depth SuberrorUnknownNCLXColorPrimaries SuberrorCode = C.heif_suberror_Unknown_NCLX_color_primaries SuberrorUnknownNCLXTransferCharacteristics SuberrorCode = C.heif_suberror_Unknown_NCLX_transfer_characteristics SuberrorUnknownNCLXMatrixCoefficients SuberrorCode = C.heif_suberror_Unknown_NCLX_matrix_coefficients // Invalid specification of region item SuberrorInvalidRegionData SuberrorCode = C.heif_suberror_Invalid_region_data // A security limit preventing unreasonable memory allocations was exceeded by the input file. // Please check whether the file is valid. If it is, contact us so that we could increase the // security limits further. SuberrorSecurityLimitExceeded SuberrorCode = C.heif_suberror_Security_limit_exceeded // also used for Invalid_input SuberrorNonexistingItemReferenced SuberrorCode = C.heif_suberror_Nonexisting_item_referenced // An API argument was given a NULL pointer, which is not allowed for that function. SuberrorNullPointerArgument SuberrorCode = C.heif_suberror_Null_pointer_argument // Image channel referenced that does not exist in the image SuberrorNonexistingImageChannelReferenced SuberrorCode = C.heif_suberror_Nonexisting_image_channel_referenced // The version of the passed plugin is not supported. SuberrorUnsupportedPluginVersion SuberrorCode = C.heif_suberror_Unsupported_plugin_version // The version of the passed writer is not supported. SuberrorUnsupportedWriterVersion SuberrorCode = C.heif_suberror_Unsupported_writer_version // The given (encoder) parameter name does not exist. SuberrorUnsupportedParameter SuberrorCode = C.heif_suberror_Unsupported_parameter // The value for the given parameter is not in the valid range. SuberrorInvalidParameterValue SuberrorCode = C.heif_suberror_Invalid_parameter_value // Error in property specification SuberrorInvalidProperty SuberrorCode = C.heif_suberror_Invalid_property // Image reference cycle found in iref SuberrorItemReferenceCycle SuberrorCode = C.heif_suberror_Item_reference_cycle // Image was coded with an unsupported compression method. SuberrorUnsupportedCodec SuberrorCode = C.heif_suberror_Unsupported_codec // Image is specified in an unknown way, e.g. as tiled grid image (which is supported) SuberrorUnsupportedImageType SuberrorCode = C.heif_suberror_Unsupported_image_type SuberrorUnsupportedDataVersion SuberrorCode = C.heif_suberror_Unsupported_data_version // The conversion of the source image to the requested chroma / colorspace is not supported. SuberrorUnsupportedColorConversion SuberrorCode = C.heif_suberror_Unsupported_color_conversion SuberrorUnsupportedItemConstructionMethod SuberrorCode = C.heif_suberror_Unsupported_item_construction_method SuberrorUnsupportedHeaderCompressionMethod SuberrorCode = C.heif_suberror_Unsupported_header_compression_method SuberrorUnsupportedBitDepth SuberrorCode = C.heif_suberror_Unsupported_bit_depth SuberrorCannotWriteOutputData SuberrorCode = C.heif_suberror_Cannot_write_output_data SuberrorEncoderInitialization SuberrorCode = C.heif_suberror_Encoder_initialization SuberrorEncoderEncoding SuberrorCode = C.heif_suberror_Encoder_encoding SuberrorEncoderCleanup SuberrorCode = C.heif_suberror_Encoder_cleanup SuberrorTooManyRegions SuberrorCode = C.heif_suberror_Too_many_regions // a specific plugin file cannot be loaded SuberrorPluginLoadingError SuberrorCode = C.heif_suberror_Plugin_loading_error // trying to remove a plugin that is not loaded SuberrorPluginIsNotLoaded SuberrorCode = C.heif_suberror_Plugin_is_not_loaded // error while scanning the directory for plugins SuberrorCannotReadPluginDirectory SuberrorCode = C.heif_suberror_Cannot_read_plugin_directory )