imgio

package
v0.0.0-...-c71c20e Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewImage

func NewImage(colorModel color.Model, bounds image.Rectangle) draw.Image

NewImage constructs a new image.

func WriteImage

func WriteImage(fname string, imgWithMetadata WithMetadata, compressionQuality int)

WriteImage writes to an image file. Compression is chosen based on the filename.

Types

type JPEGSegment

type JPEGSegment jpegstructure.Segment

JPEGSegment adds some more functions to jpegstructure.Segment. All functions we need from jpegstructure.Segment have to be wrapped on this type as well.

func (*JPEGSegment) Exif

func (s *JPEGSegment) Exif() (rootIfd *goexif.Ifd, data []byte, err error)

func (*JPEGSegment) IsExif

func (s *JPEGSegment) IsExif() bool

func (*JPEGSegment) IsICC

func (s *JPEGSegment) IsICC() bool

ICC can be stored in multiple sequential JPEG segments, as the ICC profiles can be larger than a single segment allows.

func (*JPEGSegment) IsIptc

func (s *JPEGSegment) IsIptc() bool

func (*JPEGSegment) IsJFIF

func (s *JPEGSegment) IsJFIF() bool

func (*JPEGSegment) IsMetadata

func (s *JPEGSegment) IsMetadata() bool

IsMetadata determines whether a segment is considered 'metadata', and thus has to be copied from the input file to the output of Skyfill.

func (*JPEGSegment) IsXmp

func (s *JPEGSegment) IsXmp() bool

func (*JPEGSegment) SetExif

func (s *JPEGSegment) SetExif(ib *goexif.IfdBuilder) error

type Mutable

type Mutable interface {
	image.Image
	Set(x, y int, c color.Color)
}

Mutable images can have their pixel set to a certain colour.

type WithMetadata

type WithMetadata struct {
	Image    Mutable
	Format   string
	Metadata []*JPEGSegment
}

WithMetadata contains a mutable image with its JPEG metadata. The Metadata field is only non-nil if Format = "jpeg".

func LoadImage

func LoadImage(filename string) WithMetadata

LoadImage loads an image, converting it to RGBA if necessary.

func (*WithMetadata) AddGPanoXMP

func (wm *WithMetadata) AddGPanoXMP() error

AddGPanoXMP adds an XMP section indicating that this is a panorama photo.

  • If there is no XMP metadata section yet, it is added.
  • If there is XMP already, it is extended.
  • If there is already a GPano section in there, this function assumes it is correct and doesn't touch it.

func (*WithMetadata) AddThumbnail

func (wm *WithMetadata) AddThumbnail() error

AddThumbnail downscales the image to thumbnail size, and stores it as EXIF thumbnail.

func (*WithMetadata) HasEXIFSegment

func (wm *WithMetadata) HasEXIFSegment() bool

func (*WithMetadata) HasXMPSegment

func (wm *WithMetadata) HasXMPSegment() bool

func (*WithMetadata) MetadataTypes

func (wm *WithMetadata) MetadataTypes() []string

MetadataTypes returns a slice of "EXIF", "IPTC", etc, depending on which metadata has been found. The returned slice has the same length as wm.Metadata.

func (*WithMetadata) RawSegments

func (wm *WithMetadata) RawSegments() []*jpegstructure.Segment

func (*WithMetadata) XMPBytes

func (wm *WithMetadata) XMPBytes() []byte

func (*WithMetadata) XMPBytesSet

func (wm *WithMetadata) XMPBytesSet(xmpBytes []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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