photoshop

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//IptcId id for Iptc resource
	IptcId uint16 = 0x0404
	//DigestId id for Digest resource
	DigestId uint16 = 0x0425
)

Variables

View Source
var ErrNoData = fmt.Errorf("Block contains no data")

ErrNoData no data in block

View Source
var ErrNoPhotoshopBlock = fmt.Errorf("Image contained no photoshop data")

ErrNoPhotoshopBlock could not find a photoshop segment/block in an image

View Source
var ErrNoPrefix = fmt.Errorf("Block does not contain photoshop prefix")

ErrNoPrefix expected photoshop block prefix

Functions

func Decode

func Decode(r io.Reader, checkPrefix bool) (map[uint16]ImageResource, error)

Decode photoshop image resources according to https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037504

func Marshal

func Marshal(source map[uint16]ImageResource, addPrefix bool) ([]byte, error)

Marshal writes photoshop images resources. If addPrefix adds the photoshop block prefix ("Photoshop 3.0\000")

func ParseJpeg

func ParseJpeg(sl *jpegstructure.SegmentList) (int, map[uint16]ImageResource, error)

ParseJpeg reads a jpeg segement list and extract the photoshop resources (if they exist)

func Unmarshal

func Unmarshal(data []byte, hasPrefix bool, dest *map[uint16]ImageResource) error

Unmarshal reads photoshop imagesources into dest. If hasPrefix it will first scan for a photoshop block prefix ("Photoshop 3.0\000")

Types

type ImageResource added in v0.0.9

type ImageResource struct {
	//Signature is always 4 bytes and should be 8BIM
	Signature string
	//ResourceId. E.g. 0x0404 for Iptc Data
	ResourceId uint16
	//Name of the resource. Most often this ""
	Name string
	//Image resource data
	Data []byte
}

ImageResource holds a photoshop image source

func NewPhotoshopImageResource

func NewPhotoshopImageResource(resourceId uint16, data []byte) ImageResource

NewPhotoshopImageResource from an id and data

func (ImageResource) String added in v0.0.9

func (ir ImageResource) String() string

Jump to

Keyboard shortcuts

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