Documentation
¶
Index ¶
- Constants
- Variables
- func Decode(r io.Reader, checkPrefix bool) (map[uint16]ImageResource, error)
- func Encode(w io.Writer, source map[uint16]ImageResource, addPrefix bool) error
- func Marshal(source map[uint16]ImageResource, addPrefix bool) ([]byte, error)
- func ParseJpeg(sl *jpegstructure.SegmentList) (int, map[uint16]ImageResource, error)
- func Unmarshal(data []byte, hasPrefix bool, dest *map[uint16]ImageResource) error
- type ImageResource
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 ¶
Decode photoshop image resources according to https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037504
func Encode ¶
Encode 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)
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
Click to show internal directories.
Click to hide internal directories.