Files
QSfera/vendor/github.com/kovidgoyal/imaging/prism/meta/data.go
T
dependabot[bot]andRalf Haferkamp d76cacd99f build(deps): bump github.com/kovidgoyal/imaging from 1.6.4 to 1.7.2
Bumps [github.com/kovidgoyal/imaging](https://github.com/kovidgoyal/imaging) from 1.6.4 to 1.7.2.
- [Release notes](https://github.com/kovidgoyal/imaging/releases)
- [Changelog](https://github.com/kovidgoyal/imaging/blob/master/.goreleaser.yaml)
- [Commits](https://github.com/kovidgoyal/imaging/compare/v1.6.4...v1.7.2)

---
updated-dependencies:
- dependency-name: github.com/kovidgoyal/imaging
  dependency-version: 1.7.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-23 17:48:43 +02:00

55 lines
1.3 KiB
Go

package meta
import (
"bytes"
"fmt"
"github.com/kovidgoyal/imaging/prism/meta/icc"
)
var _ = fmt.Println
// Data represents the metadata for an image.
type Data struct {
Format ImageFormat
PixelWidth uint32
PixelHeight uint32
BitsPerComponent uint32
ExifData []byte
iccProfileData []byte
iccProfileErr error
}
// ICCProfile returns an extracted ICC profile from this metadata.
//
// An error is returned if the ICC profile could not be correctly parsed.
//
// If no profile data was found, nil is returned without an error.
func (md *Data) ICCProfile() (*icc.Profile, error) {
if md.iccProfileData == nil {
return nil, md.iccProfileErr
}
return icc.NewProfileReader(bytes.NewReader(md.iccProfileData)).ReadProfile()
}
// ICCProfile returns the raw ICC profile data from this metadata.
//
// An error is returned if the ICC profile could not be correctly extracted from
// the image.
//
// If no profile data was found, nil is returned without an error.
func (md *Data) ICCProfileData() ([]byte, error) {
return md.iccProfileData, md.iccProfileErr
}
func (md *Data) SetICCProfileData(data []byte) {
md.iccProfileData = data
md.iccProfileErr = nil
}
func (md *Data) SetICCProfileError(err error) {
md.iccProfileData = nil
md.iccProfileErr = err
}