Help us shape the future of Go! Take the 2026 Go Developer Survey

psdkit

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 24 Imported by: 0

README

psdkit

纯 Go 的 Photoshop PSD/PSB 读取、受控编辑、保存与渲染工具库。

psdkit智能对象替换效果

  • Go 1.27.3+,核心库仅依赖标准库。
  • 按需读取原位深通道,保留未知块、原始区间和可编辑结构。
  • 提供 RGB8 合成、智能对象、文字、矢量、ICC 和部分高位深能力。
  • 同一份 Go 实现可编译到 WebAssembly,在浏览器 Worker 中运行。

当前处于早期开发阶段,部分高级语义受限制,见 能力状态与路线图。 读取、保存、显示保存预览和实时重绘是不同能力;不承诺任意文档与 Photoshop 像素一致。

安装

安装模块:

go get github.com/gopkg-dev/psdkit@v0.3.0

v0.3.0 的新增能力和升级范围见发布说明,支持边界以该 Tag 的矩阵为准。v0.2.0 的历史交付验收记录保留当时的固定提交、运行链接和校验和。

快速开始

package main

import (
	"context"
	"log"

	"github.com/gopkg-dev/psdkit"
)

func main() {
	ctx := context.Background()
	editor, err := psdkit.CreateDocument(ctx, 640, 480)
	if err != nil {
		log.Fatal(err)
	}
	defer func() { _ = editor.Close() }()
	if err := editor.SavePSD(ctx, "example.psd"); err != nil {
		log.Print(err)
	}
}

无需外部素材即可运行:

go run ./examples/create -out /tmp/example.psd
go run ./examples/index -psd /tmp/example.psd
go run ./examples/edit -psd /tmp/example.psd -out /tmp/edited.psd

文档与开发

Pages 工作流把首页与文档放在站点根路径,把 Playground 放在 demo/。站点地址为 首页与文档 和 Playground。

make check       # 测试、vet、lint、格式和 SDK 测试。
make race        # Go 竞态检测。
make web         # Wasm、示例 PSD 与 Playground,需要 Node.js 24。
make site        # 文档 + Playground 组装到 _site/,需要 Ruby/Bundler。
make site-preview  # 在 http://127.0.0.1:8301/psdkit/ 预览完整站点。

make tools 在本仓库 .tools/ 安装固定版本 golangci-lint,不修改全局工具。 小型回归素材跟随包;大型 oracle、私有样例和研发记录已独立存放。

项目采用 MIT。第三方代码和素材见 来源与许可。

Documentation

Overview

Package psdkit reads and renders a bounded subset of Photoshop PSD documents in pure Go.

OpenDocument indexes PSD/PSB sources while preserving original blocks and encoded channels. It decodes source samples on demand without reducing their bit depth. Open/Parse/Read remain eager RGB8 compatibility APIs. OpenEditor provides controlled edits and PSD/PSB saving. Encode exports rendered PNG or JPEG images.

Treat documents, input images and returned images as read-only while a renderer uses them. Some rendering and output operations borrow existing pixel buffers; copy pixels before editing.

Index

Constants

View Source
const (
	// EffectInnerShadow selects an inner shadow effect.
	EffectInnerShadow = psdeffects.InnerShadow
	// EffectInnerGlow selects an inner glow effect.
	EffectInnerGlow = psdeffects.InnerGlow
	// GlowSourceEdge paints inner coverage approaching the source edges.
	GlowSourceEdge = psdeffects.Edge
	// GlowSourceCenter paints the complementary inner-glow source.
	GlowSourceCenter = psdeffects.CenterSource
)
View Source
const (
	// AdjustmentInvert complements encoded RGB channels.
	AdjustmentInvert = psdadjust.Invert
	// AdjustmentThreshold selects black or white by luminance.
	AdjustmentThreshold = psdadjust.Threshold
	// AdjustmentPosterize quantizes color channels to selected levels.
	AdjustmentPosterize = psdadjust.Posterize
	// AdjustmentLevels adjusts input/output ranges and gamma.
	AdjustmentLevels = psdadjust.Levels
	// AdjustmentCurves applies channel and composite tonal curves.
	AdjustmentCurves = psdadjust.Curves
	// AdjustmentExposure applies native-verified RGB8 exposure controls.
	AdjustmentExposure = psdadjust.Exposure
	// AdjustmentChannelMixer applies a calibrated RGB8 channel matrix and constants.
	AdjustmentChannelMixer = psdadjust.ChannelMixer
	// AdjustmentColorBalance identifies retained color-balance metadata with neutral-only rendering.
	AdjustmentColorBalance = psdadjust.ColorBalance
	// AdjustmentHueSaturation selects RGB8 hue, saturation and lightness controls.
	AdjustmentHueSaturation = psdadjust.HueSaturation
	// AdjustmentPhotoFilter selects typed filter metadata; only zero-density RGB8 rendering is verified.
	AdjustmentPhotoFilter = psdadjust.PhotoFilter
)
View Source
const (
	// IntentRelativeColorimetric selects relative colorimetry without black-point compensation.
	IntentRelativeColorimetric = psdcolor.IntentRelativeColorimetric
	// IntentPerceptual selects the profile's perceptual transform.
	IntentPerceptual = psdcolor.IntentPerceptual
	// IntentSaturation selects the profile's saturation transform.
	IntentSaturation = psdcolor.IntentSaturation
)
View Source
const (
	// KnockoutNone preserves ordinary source-over behavior.
	KnockoutNone = psdmodel.KnockoutNone
	// KnockoutShallow stops at the enclosing group or clipping base.
	KnockoutShallow = psdmodel.KnockoutShallow
	// KnockoutDeep reveals the document Background across pass-through groups.
	KnockoutDeep = psdmodel.KnockoutDeep
)
View Source
const (
	// MaxPixels bounds each decoded canvas, layer or mask.
	MaxPixels = psdmodel.MaxPixels
	// MaxDimension bounds each side of a decoded image.
	MaxDimension = psdmodel.MaxDimension
	// MaxDecodedPixels bounds the combined canvas, layer and mask pixel count.
	MaxDecodedPixels = psdmodel.MaxDecodedPixels
	// MaxInputPixels bounds the combined unique replacement and background pixel count.
	MaxInputPixels = psdrender.MaxInputPixels
	// MaxLayers bounds the number of decoded layer records.
	MaxLayers = psdmodel.MaxLayers
	// MaxFileBytes bounds the encoded PSD source size.
	MaxFileBytes = psdmodel.MaxFileBytes
)
View Source
const (
	// OpenTypeTextBlueGrid preserves default blue-zone fitting.
	OpenTypeTextBlueGrid = psdscene.OpenTypeTextBlueGrid
	// OpenTypeTextBlueResolvedOutward fits resolvable source zones outward from the device baseline.
	OpenTypeTextBlueResolvedOutward = psdscene.OpenTypeTextBlueResolvedOutward
)
View Source
const (
	// OpenTypeTextHintNone preserves default unhinted text rendering.
	OpenTypeTextHintNone = psdscene.OpenTypeTextHintNone
	// OpenTypeTextHintVertical fits source CFF1 horizontal stems and blue zones in device Y.
	OpenTypeTextHintVertical = psdscene.OpenTypeTextHintVertical
	// OpenTypeTextHintFull additionally fits source CFF1 vertical stems in device X.
	OpenTypeTextHintFull = psdscene.OpenTypeTextHintFull
	// OpenTypeTextHintFractional fits stem centers while preserving source fractional widths.
	OpenTypeTextHintFractional = psdscene.OpenTypeTextHintFractional
	// OpenTypeTextHintEdgeFractional fits the nearest stem edge while preserving source fractional widths.
	OpenTypeTextHintEdgeFractional = psdscene.OpenTypeTextHintEdgeFractional
)
View Source
const (
	// OpenTypeFauxBoldOutline retains the original outline-only model and source advances.
	OpenTypeFauxBoldOutline = psdscene.OpenTypeFauxBoldOutline
	// OpenTypeFauxBoldExpandedAdvance adds source-em synthetic advance to each shaped glyph, including spaces.
	// It selects anchored outline expansion and requires approximate single-style typography.
	OpenTypeFauxBoldExpandedAdvance = psdscene.OpenTypeFauxBoldExpandedAdvance
)
View Source
const (
	// OpenTypeRejectMixedClusterPaint preserves the default rejection of mixed RGBA glyph clusters.
	OpenTypeRejectMixedClusterPaint = psdscene.OpenTypeRejectMixedClusterPaint
	// OpenTypeFirstStyleClusterPaint paints a cluster using its logical start style's entire RGBA.
	// It requires compatible typography and does not certify Photoshop antialiasing or general native coloring.
	OpenTypeFirstStyleClusterPaint = psdscene.OpenTypeFirstStyleClusterPaint
)
View Source
const (
	// OpenTypeSingleStyle preserves the default single-style source contract.
	OpenTypeSingleStyle = psdscene.OpenTypeSingleStyle
	// OpenTypeIsolatedStyleRuns independently shapes and paints each source style.
	OpenTypeIsolatedStyleRuns = psdscene.OpenTypeIsolatedStyleRuns
	// OpenTypeCompatibleStyleRuns permits matching typography to shape across color boundaries.
	OpenTypeCompatibleStyleRuns = psdscene.OpenTypeCompatibleStyleRuns
)
View Source
const (
	// OpenTypeTextNone disables optional OpenType kerning.
	OpenTypeTextNone = psdscene.OpenTypeTextNone
	// OpenTypeTextMetrics enables supported OpenType metric pair positioning.
	OpenTypeTextMetrics = psdscene.OpenTypeTextMetrics
)
View Source
const SmartFilterBrightnessContrast = psdfilter.BrightnessContrast

SmartFilterBrightnessContrast selects explicitly approximate encoded-RGB tonal adjustment.

View Source
const SmartFilterGaussianBlur = psdfilter.GaussianBlur

SmartFilterGaussianBlur selects the explicitly approximate integrated Gaussian algorithm.

View Source
const SmartFilterHueSaturation = psdfilter.HueSaturation

SmartFilterHueSaturation selects the explicit hue and circular color-range adjustment policy.

View Source
const SmartFilterSmartSharpen = psdfilter.SmartSharpen

SmartFilterSmartSharpen selects explicitly approximate sharpening with noise reduction.

View Source
const SmartFilterSurfaceBlur = psdfilter.SurfaceBlur

SmartFilterSurfaceBlur selects the explicitly approximate edge-preserving surface blur.

Variables

View Source
var (
	// ErrColorInvalid identifies malformed color samples, profiles or conversion options.
	ErrColorInvalid = psdcolor.ErrInvalid
	// ErrColorUnsupported identifies an unsupported color space or ICC transform.
	ErrColorUnsupported = psdcolor.ErrUnsupported
	// ErrColorLimit identifies a display conversion allocation budget violation.
	ErrColorLimit = psdcolor.ErrLimit
	// ErrColorNonFinite identifies rejected NaN or infinite floating samples.
	ErrColorNonFinite = psdcolor.ErrNonFinite
	// ErrColorOutOfRange identifies rejected HDR or negative floating samples.
	ErrColorOutOfRange = psdcolor.ErrOutOfRange
)
View Source
var (
	// ErrCompositeUnsupported identifies features not supported by layer-tree reconstruction.
	ErrCompositeUnsupported = psdcompose.ErrUnsupported
	// ErrCompositeInvalid identifies invalid decoded geometry, pixels or layer-tree data.
	ErrCompositeInvalid = psdcompose.ErrInvalid
	// ErrCompositeLimit identifies exceeded layer-tree or working-memory limits.
	ErrCompositeLimit = psdcompose.ErrLimit
)
View Source
var (
	// ErrInvalidEdit identifies invalid editing handles, layer operations or replacement inputs.
	ErrInvalidEdit = psdedit.ErrInvalidEdit
	// ErrUnsupportedEdit identifies an edit or automatic composite feature deferred to later phases.
	ErrUnsupportedEdit = psdedit.ErrUnsupported
	// ErrStaleLinkedEdit rejects a resolver result after concurrent editor changes.
	ErrStaleLinkedEdit = psdedit.ErrStaleLinkedEdit
	// ErrStaleNativeTextState rejects an accurate native text snapshot prepared for another editor revision.
	ErrStaleNativeTextState = psdedit.ErrStaleNativeTextState
)
View Source
var (
	// ErrUnsupported identifies features that prevent rendering; use errors.Is to check it.
	ErrUnsupported = psdrender.ErrUnsupported
	// ErrImageSize identifies invalid or unsupported image dimensions; use errors.Is to check it.
	ErrImageSize = psdrender.ErrImageSize
)
View Source
var (
	// ErrClosed identifies a closed SourceDocument.
	ErrClosed = psdfile.ErrClosed
	// ErrMalformed identifies invalid or truncated PSD/PSB data.
	ErrMalformed = psdfile.ErrMalformed
	// ErrLimit identifies a configured source or decode budget violation.
	ErrLimit = psdfile.ErrLimit
	// ErrUnsupportedDecode identifies unsupported source-plane or descriptor decoding.
	ErrUnsupportedDecode = psdfile.ErrUnsupported
)

Functions

func ApplySmartFilters

func ApplySmartFilters(ctx context.Context, source *image.NRGBA, stack SmartFilterPipeline,
	options ...SmartFilterOptions,
) (*image.NRGBA, error)

ApplySmartFilters executes a bounded pipeline and returns owned pixels.

func AssertImageSize

func AssertImageSize(width, height int) error

AssertImageSize checks dimensions before allocating or decoding an image.

func BuildRasterContents

func BuildRasterContents(ctx context.Context, input *image.NRGBA,
	options ...RasterContentsOptions,
) ([]byte, error)

BuildRasterContents builds editable PSD/PSB content without cropping or changing input samples.

func Composite

func Composite(ctx context.Context, document *Document, options ...CompositeOptions) (*image.NRGBA, error)

Composite rebuilds an owned RGB8 image from layers, independent of the saved preview. It borrows an immutable decoded document and never modifies source buffers.

func CompositeRegion

func CompositeRegion(ctx context.Context, document *Document, bounds image.Rectangle,
	options ...CompositeOptions,
) (*image.NRGBA, error)

CompositeRegion rebuilds an owned absolute-coordinate RGB8 window from an immutable layer tree.

func ConvertSamples

func ConvertSamples(ctx context.Context, pixels *CompositePixels, options ...ColorOptions) (*image.NRGBA, error)

ConvertSamples returns an owned sRGB8 display image without changing original sample bytes.

func DecodeDisplayComposite

func DecodeDisplayComposite(
	ctx context.Context, source *SourceDocument, options ...DisplayOptions,
) (*image.NRGBA, error)

DecodeDisplayComposite converts stored composite samples using their palette, ICC and transparency markers. It displays the saved preview, including any placeholder or quantization already present in that preview. This operation does not re-render high-precision document layers or change their source precision.

func DecodeDisplayRegion

func DecodeDisplayRegion(ctx context.Context, source *SourceDocument, rectangle image.Rectangle,
	options ...RegionDisplayOptions,
) (*image.NRGBA, error)

DecodeDisplayRegion returns an owned sRGB8 display tile at absolute saved-canvas coordinates. Raw/RLE reads selected pixels; ZIP still validates its complete shared compressed stream. It displays stored merged samples and does not reconstruct document layers or alter source precision.

func EmptyImage

func EmptyImage(width, height int) (*image.NRGBA, error)

EmptyImage allocates a bounded transparent straight-alpha image.

func Encode

func Encode(writer io.Writer, source *image.NRGBA, format string) error

Encode writes PNG or quality-95 JPEG pixels without modifying source or closing writer. It exports a raster image, not a PSD file. JPEG transparency is flattened against white.

func EncodeVectorMask

func EncodeVectorMask(ctx context.Context, mask *VectorMask, options ...VectorEncodeOptions) ([]byte, error)

EncodeVectorMask returns an owned vmsk/vsms payload containing the mask's current typed fields.

func PrepareOutput

func PrepareOutput(source *image.NRGBA, options Options) (*image.NRGBA, error)

PrepareOutput shrinks an image to Options.MaxSize and otherwise borrows the original pixels. The returned image must be treated as read-only. Format must be "png" or "jpeg".

func ProfileTransformWorkingBytes

func ProfileTransformWorkingBytes(ctx context.Context, input *image.NRGBA, sourceICC, destinationICC []byte,
	options ...ProfileTransformOptions,
) (int64, error)

ProfileTransformWorkingBytes estimates additional peak storage excluding borrowed inputs.

func RasterContentsWorkingBytes

func RasterContentsWorkingBytes(ctx context.Context, input *image.NRGBA,
	options ...RasterContentsOptions,
) (int64, error)

RasterContentsWorkingBytes estimates conservative peak storage before constructing a prototype.

func RasterizeFontRun

func RasterizeFontRun(
	ctx context.Context, run *FontRun, bounds image.Rectangle, options ...FontRasterOptions,
) (*image.Alpha, error)

RasterizeFontRun returns owned grayscale coverage in the supplied absolute pixel rectangle. It applies the existing unhinted approximation without text color, warps or Photoshop antialias modes.

func RasterizeVectorMask

func RasterizeVectorMask(ctx context.Context, mask *VectorMask, bounds image.Rectangle,
	options ...VectorOptions,
) (*image.Alpha, error)

RasterizeVectorMask returns owned approximate filled-path coverage for absolute canvas bounds.

func ReadSourceRGBProfile

func ReadSourceRGBProfile(ctx context.Context, source *SourceDocument, maxBytes int64) ([]byte, error)

ReadSourceRGBProfile returns owned saved ICC bytes without guessing an untagged working space.

func RenderArtboard

func RenderArtboard(ctx context.Context, source *SourceDocument,
	options ...ArtboardRenderOptions,
) (*image.NRGBA, error)

RenderArtboard rebuilds one selected board from its live layers and saved background. Visible smart objects use actual contents; external sources and approximations require explicit Render policies.

func RenderOpenTypeTextLayer

func RenderOpenTypeTextLayer(
	ctx context.Context, source *SourceDocument, record TextLayerRecord,
	resolver FontResolver, options OpenTypeTextRenderOptions,
) (*image.NRGBA, error)

RenderOpenTypeTextLayer returns owned approximate source pixels for supported RGB8 point text. It verifies the record against source metadata and uses explicit caller-selected fonts and features. The default supports single-line Latin at 72ppi, Sharp metadata and no text warp. ApproximateTypography also executes supported point paragraphs, tracking, leading, capitalization and FauxBold. FauxBold selects outline-only or explicit synthetic advance and anchored outline expansion. One style remains the default; explicit StyleBoundaries selects approximate multi-style typography. ClusterPaint defaults to rejecting mixed colors; explicit FirstStyle selects the logical start style's entire RGBA. Native style-boundary coloring and antialiasing remain unqualified beyond finite reference observations. Optional Hinting fits preserved CFF1 source hints without executing TrueType instructions. Layer masks, opacity, effects and blending apply separately; native pixel equality is not guaranteed.

func RenderPattern

func RenderPattern(ctx context.Context, tile *image.NRGBA, fill PatternFill, bounds image.Rectangle,
	options ...PatternOptions,
) (*image.NRGBA, error)

RenderPattern samples an explicitly supplied RGB8 tile without preset or filesystem lookups.

func RenderSource

func RenderSource(ctx context.Context, source *SourceDocument, options ...SceneOptions) (*image.NRGBA, error)

RenderSource rebuilds source layers and embedded or explicitly resolved PSD/PSB/PNG/JPEG/TIFF contents. It returns owned encoded-RGB pixels in the document or explicitly requested output profile.

func RenderSourceTile

func RenderSourceTile(ctx context.Context, source *SourceDocument, bounds image.Rectangle,
	options ...TileOptions,
) (*image.NRGBA, error)

RenderSourceTile rebuilds an RGB8 window without allocating the complete source canvas. The returned owned image retains absolute document coordinates.

func RenderTextLayer

func RenderTextLayer(ctx context.Context, source *SourceDocument, record TextLayerRecord,
	resolver FontResolver, options ...TextRenderOptions,
) (*image.NRGBA, error)

RenderTextLayer returns owned approximate source pixels for a supported point-text layer. Apply layer masks, opacity and blending separately or opt into SceneOptions.ApproximateText.

func TransformProfile

func TransformProfile(ctx context.Context, input *image.NRGBA, sourceICC, destinationICC []byte,
	options ...ProfileTransformOptions,
) (*image.NRGBA, error)

TransformProfile returns owned RGB8 pixels in the destination profile while preserving alpha.

func ValidateConfig

func ValidateConfig(config Config, metadata Metadata) error

ValidateConfig rejects invalid fitting, stale targets and conflicting replacements.

func ValidateOptions

func ValidateOptions(options Options) error

ValidateOptions checks the PNG/JPEG output format and longest-edge limit.

func VisitSourcePrecisionTiles

func VisitSourcePrecisionTiles(ctx context.Context, source *SourceDocument, bounds image.Rectangle, size image.Point,
	visit func(*FloatRegion) error, options ...TileOptions,
) error

VisitSourcePrecisionTiles traverses a source window without retaining the complete output canvas.

func VisitSourceTiles

func VisitSourceTiles(ctx context.Context, source *SourceDocument, bounds image.Rectangle, size image.Point,
	visit func(*image.NRGBA) error, options ...TileOptions,
) error

VisitSourceTiles rebuilds a source window one owned tile at a time in row-major order. Pixels retained by the callback are caller storage and are outside the per-tile budget.

Types

type AdditionalBlock

type AdditionalBlock = psdfile.AdditionalBlock

AdditionalBlock describes an original layer or document extension block.

type Adjustment

type Adjustment = psdadjust.Adjustment

Adjustment contains typed RGB8 tonal controls and retained original encoding.

type AdjustmentKind

type AdjustmentKind = psdadjust.Kind

AdjustmentKind identifies a tonal adjustment family.

type AdvancedBlendingOptions added in v0.2.0

type AdvancedBlendingOptions = psdedit.AdvancedBlendingOptions

AdvancedBlendingOptions selects optional advanced blending metadata changes.

type ArtboardData

type ArtboardData = psdfile.ArtboardData

ArtboardData owns ordered artboard descriptors without promising clipping or background rendering.

type ArtboardImage

type ArtboardImage = psdscene.ArtboardImage

ArtboardImage contains one board's owned pixels and retained saved coordinates.

func RenderArtboards

func RenderArtboards(ctx context.Context, source *SourceDocument,
	options ...ArtboardRenderOptions,
) ([]ArtboardImage, error)

RenderArtboards rebuilds every top-level RGB8 PSD/PSB artboard independently. Shared live contents are resolved once per call while each board retains its own background and crop.

type ArtboardRecord

type ArtboardRecord = psdfile.ArtboardRecord

ArtboardRecord associates retained artboard metadata with its source physical layer.

type ArtboardRenderOptions

type ArtboardRenderOptions = psdscene.ArtboardRenderOptions

ArtboardRenderOptions bounds RGB8 artboard renders and optionally selects one physical board. Render supplies live placed-source resolvers and explicit source approximation policies.

type BackgroundLayer

type BackgroundLayer = psdrender.BackgroundLayer

BackgroundLayer describes a saved raster available for background replacement.

type BlendRange

type BlendRange = psdmodel.BlendRange

BlendRange pairs source and underlying sliders; the first range is gray, followed by RGB.

type BlendSlider

type BlendSlider = psdmodel.BlendSlider

BlendSlider describes the split black and white endpoints of a Blend If slider.

type Candidate

type Candidate = psdrender.Candidate

Candidate describes an external image available for random background selection.

type ChannelMixerParams

type ChannelMixerParams = psdadjust.ChannelMixerParams

ChannelMixerParams contains signed RGB channel coefficients and constants.

type ChannelRecord

type ChannelRecord = psdfile.ChannelRecord

ChannelRecord indexes encoded layer samples and their compression.

type ColorBalanceParams

type ColorBalanceParams = psdadjust.ColorBalanceParams

ColorBalanceParams retains uncalibrated nonneutral color-balance controls.

type ColorOptions

type ColorOptions = psdcolor.Options

ColorOptions controls explicit conversion from original source samples to sRGB8 display pixels.

func DefaultColorOptions

func DefaultColorOptions() ColorOptions

DefaultColorOptions returns explicit default display policies and budgets.

type CompositeOptions

type CompositeOptions = psdcompose.Options

CompositeOptions bounds RGB8 layer-tree reconstruction and its working allocations.

type CompositePixels

type CompositePixels = psdfile.CompositePixels

CompositePixels contains the decoded saved-image planes without color conversion.

type Config

type Config = psdrender.Config

Config controls replacement targets, fitting and alignment.

func DefaultConfig

func DefaultConfig(metadata Metadata) Config

DefaultConfig enables each visible smart object using its source filename as the image tag.

type CreateOptions

type CreateOptions = psdedit.CreateOptions

CreateOptions selects a new RGB8 document's PSD/PSB version and allocation limits.

type Descriptor

type Descriptor = psdfile.Descriptor

Descriptor preserves ordered typed Action descriptor entries and their original source spans.

type DescriptorBlob

type DescriptorBlob = psdfile.DescriptorBlob

DescriptorBlob indexes a descriptor payload without copying its bytes.

type DescriptorClass

type DescriptorClass = psdfile.DescriptorClass

DescriptorClass retains the original class name and identifier encoding.

type DescriptorEncodeOptions

type DescriptorEncodeOptions = psdfile.DescriptorEncodeOptions

DescriptorEncodeOptions bounds source-aware ordered descriptor encoding.

type DescriptorEntry

type DescriptorEntry = psdfile.DescriptorEntry

DescriptorEntry preserves one descriptor key, OSType and typed value without deduplicating keys.

type DescriptorEnum

type DescriptorEnum = psdfile.DescriptorEnum

DescriptorEnum retains an enumeration's type and value identifiers.

type DescriptorEnumeratedReference

type DescriptorEnumeratedReference = psdfile.DescriptorEnumeratedReference

DescriptorEnumeratedReference retains the class and enumeration of a reference.

type DescriptorNamedReference

type DescriptorNamedReference = psdfile.DescriptorNamedReference

DescriptorNamedReference retains a class and its referenced object name.

type DescriptorObjectArray

type DescriptorObjectArray = psdfile.DescriptorObjectArray

DescriptorObjectArray retains the original ObAr prefix and ordered columns.

type DescriptorOffset

type DescriptorOffset = psdfile.DescriptorOffset

DescriptorOffset retains a class-relative reference offset.

type DescriptorProperty

type DescriptorProperty = psdfile.DescriptorProperty

DescriptorProperty associates a property identifier with its class.

type DescriptorReference

type DescriptorReference = psdfile.DescriptorReference

DescriptorReference contains ordered typed Action reference items.

type DescriptorUnit

type DescriptorUnit = psdfile.DescriptorUnit

DescriptorUnit retains a scalar unit number, width and exact IEEE bits.

type DescriptorUnitArray

type DescriptorUnitArray = psdfile.DescriptorUnitArray

DescriptorUnitArray retains an ObAr column's units and source-precision values.

type DescriptorValue

type DescriptorValue = psdfile.DescriptorValue

DescriptorValue represents a typed list or reference item.

type DisplayOptions

type DisplayOptions struct {
	Color               ColorOptions
	IgnoreSourceProfile bool
	IgnoreTransparency  bool
}

DisplayOptions selects source color context for a saved-image display conversion. A non-nil Color.ICCProfile overrides the source profile; an empty non-nil slice explicitly disables it.

type Document

type Document = psdmodel.Document

Document contains decoded RGB8 data, with layers ordered bottom to top. A renderer borrows its document; callers must not modify it until all renderers stop using it.

func Open

func Open(filename string) (document *Document, err error)

Open reads an RGB8 PSD/PSB file and closes it before returning decoded pixels and metadata. Use OpenDocument for original-block retention and on-demand source-precision decoding.

func Parse

func Parse(data []byte) (document *Document, err error)

Parse eagerly reads an in-memory RGB8 PSD/PSB without retaining or copying its encoded source.

func Read

func Read(reader io.ReaderAt, size int64) (document *Document, err error)

Read eagerly reads a bounded RGB8 PSD/PSB from a random-access source of the supplied size. It does not close or retain reader; the caller owns the source's lifetime.

type DocumentTextAssociation

type DocumentTextAssociation = psdfile.DocumentTextAssociation

DocumentTextAssociation pairs a physical text layer with its checked document engine record.

type DocumentTextAssociationView

type DocumentTextAssociationView = psdfile.DocumentTextAssociationView

DocumentTextAssociationView owns text layer descriptors and borrows checked document engine records.

type DocumentTextBlock

type DocumentTextBlock = psdfile.DocumentTextBlock

DocumentTextBlock retains one document-wide Txt2 payload as an original lazy span.

type DocumentTextView

type DocumentTextView = psdfile.DocumentTextView

DocumentTextView reports lazy document text blocks and their metadata reservation.

type EditChanges

type EditChanges = psdedit.Changes

EditChanges reports revisions, unsaved changes and composite/structure changes relative to the source.

type EditLayerInfo

type EditLayerInfo = psdedit.LayerInfo

EditLayerInfo is an owned layer-tree view with bottom-to-top sibling order.

type Editor

type Editor = psdedit.Editor

Editor applies controlled overlays to an immutable source and writes PSD/PSB files. Blend, clipping, Blend If, mask and advanced blending edits preserve the same source ownership.

func CreateDocument

func CreateDocument(ctx context.Context, width, height int, options ...CreateOptions) (*Editor, error)

CreateDocument returns an owned editor containing one transparent canvas-sized RGB8 layer. Populate handle 1 with ReplacePixels or add layers and groups before SavePSD.

func NewEditor

func NewEditor(source *SourceDocument) (*Editor, error)

NewEditor borrows an indexed source; closing the editor does not close that source.

func OpenEditor

func OpenEditor(filename string, options ...LoadOptions) (*Editor, error)

OpenEditor owns an indexed PSD/PSB source and releases it when the editor is closed.

type Effect

type Effect = psdeffects.Effect

Effect contains one typed layer-effect instance and retained descriptor fields.

type EffectKind

type EffectKind = psdeffects.Kind

EffectKind identifies an implemented or retained effect family.

type EffectSet

type EffectSet = psdeffects.Set

EffectSet contains ordered modern layer effects and their retained original descriptors.

type EffectsEditOptions

type EffectsEditOptions = psdedit.EffectsEditOptions

EffectsEditOptions selects explicit rendering policies for controlled effect parameter edits.

type FileHeader

type FileHeader = psdfile.Header

FileHeader preserves version, channels, source dimensions, depth and color mode.

type FilterCacheArray

type FilterCacheArray = psdfile.FilterCacheArray

FilterCacheArray indexes deferred samples or a retained filter mask in their original precision.

type FilterCacheRecord

type FilterCacheRecord = psdfile.FilterCacheRecord

FilterCacheRecord indexes preserved FEid/FXid data without supplying live filter output.

type FilterCacheView

type FilterCacheView = psdfile.FilterCacheView

FilterCacheView reports owned cache indexes and their metadata reservation.

type FloatImage

type FloatImage = psdprecision.FloatImage

FloatImage owns high-precision straight RGBA samples without display quantization.

func RenderSourcePrecision

func RenderSourcePrecision(ctx context.Context, source *SourceDocument,
	options ...PrecisionOptions,
) (*FloatImage, error)

RenderSourcePrecision rebuilds supported ordinary RGB/Gray16 or RGB/Gray32 layer trees. It preserves finite HDR values, source encoding and ICC bytes without applying a display transform.

type FloatRegion

type FloatRegion = psdprecision.RegionImage

FloatRegion preserves an absolute source rectangle and owned high-precision output.

func RenderSourcePrecisionTile

func RenderSourcePrecisionTile(ctx context.Context, source *SourceDocument, bounds image.Rectangle,
	options ...TileOptions,
) (*FloatRegion, error)

RenderSourcePrecisionTile reconstructs RGB/Gray16 or RGB/Gray32 in an absolute source window.

type FontFace

type FontFace = psdfont.Face

FontFace owns a TrueType, CFF1 or selected immutable CFF2 instance without executing hinting.

func OpenFont

func OpenFont(ctx context.Context, path string, options ...FontOptions) (*FontFace, error)

OpenFont opens the exact caller-selected font file without directory searches or substitutions.

type FontInstanceMetrics

type FontInstanceMetrics = psdfont.InstanceGlyphMetrics

FontInstanceMetrics retains unrounded instance glyph metrics independently of raw hmtx values.

type FontInstancePosition

type FontInstancePosition = psdfont.InstancePosition

FontInstancePosition retains precise positioning before the integer design-unit output profile.

type FontLayoutOptions

type FontLayoutOptions = psdfont.LayoutOptions

FontLayoutOptions bounds owned outlines and positions and selects a pixel baseline.

type FontNamedVariationInstance

type FontNamedVariationInstance = psdfont.NamedVariationInstance

FontNamedVariationInstance owns source name IDs and coordinates for a named fvar instance.

type FontOptions

type FontOptions = psdfont.DecodeOptions

FontOptions bounds explicit font decoding, selects a TTC face and optionally selects CFF2 axis coordinates.

type FontRasterOptions

type FontRasterOptions = psdfont.RasterOptions

FontRasterOptions bounds unhinted coverage and optionally selects an approximate FauxBold outline union.

type FontResolver

type FontResolver = psdfont.FontResolver

FontResolver resolves exact PostScript names from caller-selected fonts.

type FontResolverFunc

type FontResolverFunc = psdfont.ResolverFunc

FontResolverFunc adapts an explicit font resolution function.

type FontRun

type FontRun = psdfont.Run

FontRun owns approximate unhinted glyph outlines and pixel positions.

func LayoutOpenType

func LayoutOpenType(
	ctx context.Context, text string, style FontStyle, resolver FontResolver,
	shapeOptions OpenTypeShapeOptions, options ...FontLayoutOptions,
) (*FontRun, error)

LayoutOpenType places a single-line Latin run using explicitly selected OpenType features. Tracking must be zero and FontStyle.Kerning false; OpenTypeShapeOptions alone controls kerning. It does not reproduce hinting or Photoshop antialiasing and leaves scene text rendering unchanged.

type FontStyle

type FontStyle = psdfont.Style

FontStyle supplies an exact font name and pixel-size character style.

type FontVariationAxis

type FontVariationAxis = psdfont.VariationAxis

FontVariationAxis retains one source fvar axis and its original range.

type FontVariationCoordinate

type FontVariationCoordinate = psdfont.VariationCoordinate

FontVariationCoordinate selects one explicitly requested user-space font axis value.

type FontVariationInstanceCoordinate

type FontVariationInstanceCoordinate = psdfont.VariationInstanceCoordinate

FontVariationInstanceCoordinate records the selected user and F2DOT14 normalized coordinates.

type FontVariationMetric

type FontVariationMetric = psdfont.VariationMetric

FontVariationMetric retains a source MVAR record and its precise selected-instance delta.

type GlowSource

type GlowSource = psdeffects.GlowSource

GlowSource selects inner-glow edge or center coverage.

type GradientFill

type GradientFill = psdgradient.Fill

GradientFill contains live classic RGB gradient controls in source encoded color space.

type HueSaturationParams

type HueSaturationParams = psdadjust.HueSaturationParams

HueSaturationParams retains master, Colorize and six ordered circular color-range controls.

type HueSaturationRange

type HueSaturationRange = psdadjust.HueSaturationRange

HueSaturationRange retains one circular color range and its signed adjustment.

type HueSaturationValues

type HueSaturationValues = psdadjust.HueSaturationValues

HueSaturationValues contains signed hue, saturation and lightness controls.

type Instance

type Instance = psdrender.Instance

Instance describes one visible smart-object occurrence.

type KnockoutMode

type KnockoutMode = psdmodel.Knockout

KnockoutMode selects the backdrop revealed by a layer's shape before Fill.

type Layer

type Layer = psdmodel.Layer

Layer describes saved raster pixels, placement, opacity and supported smart-object metadata.

func RenderSourcePlacedLayer

func RenderSourcePlacedLayer(ctx context.Context, source *SourceDocument, layerIndex int,
	options ...SceneOptions,
) (*Layer, error)

RenderSourcePlacedLayer rebuilds one original smart-object layer from embedded or explicitly resolved contents. The owned result retains placement, masks and effects for subsequent composition.

type LayerID

type LayerID = psdedit.LayerID

LayerID is a stable editing handle, independent of the physical record index and PSD lyid.

type LayerMetadataView

type LayerMetadataView = psdfile.LayerMetadataView

LayerMetadataView reports owned layer semantics and bounded parser storage without decoding pixels.

type LayerPixels

type LayerPixels = psdfile.LayerPixels

LayerPixels contains decoded channels in their original depth and geometry.

type LayerRecord

type LayerRecord = psdfile.LayerRecord

LayerRecord describes a layer in physical file order, including all encoded channels.

type LayerSet

type LayerSet = psdfile.LayerSet

LayerSet indexes the main or alternate layer-information payload.

type LinkedContentsResolver

type LinkedContentsResolver = psdedit.LinkedContentsResolver

LinkedContentsResolver explicitly supplies encoded content for an external smart-object link.

type LinkedContentsUpdate

type LinkedContentsUpdate = psdedit.LinkedContentsUpdate

LinkedContentsUpdate supplies caller-owned external contents and optional timestamp metadata.

type LinkedContentsUpdateResolver

type LinkedContentsUpdateResolver = psdedit.LinkedContentsUpdateResolver

LinkedContentsUpdateResolver supplies explicitly selected contents while preserving their external link.

type LinkedDocumentResolver

type LinkedDocumentResolver = psdfile.LinkedDocumentResolver

LinkedDocumentResolver supplies an externally linked PSD/PSB selected explicitly by the caller.

type LinkedFileRecord

type LinkedFileRecord = psdfile.LinkedFileRecord

LinkedFileRecord preserves an embedded, external or alias source record and its original spans.

type LinkedFileView

type LinkedFileView = psdfile.LinkedFileView

LinkedFileView reports owned source records and their measured metadata reservation.

type LinkedRaster

type LinkedRaster = psdfile.LinkedRaster

LinkedRaster contains owned RGB8 pixels in the original embedded ICC encoding.

type LinkedRasterOptions

type LinkedRasterOptions = psdfile.LinkedRasterOptions

LinkedRasterOptions bounds embedded PNG/JPEG and flat RGB8 TIFF decoding and owned ICC storage.

type LinkedRasterResolver added in v0.2.0

type LinkedRasterResolver = psdscene.LinkedRasterResolver

LinkedRasterResolver supplies explicitly selected external PNG/JPEG/TIFF source bytes for live rendering. Returned bytes remain caller-owned and immutable until the rendering call returns.

type LoadOptions

type LoadOptions = psdfile.LoadOptions

LoadOptions configures metadata indexing and on-demand decoding limits.

type Mask

type Mask = psdmodel.Mask

Mask describes a raster mask and its default coverage outside the saved mask bounds.

type Metadata

type Metadata = psdrender.Metadata

Metadata reports supported objects, crops, warnings and blocking rendering issues.

func Inspect

func Inspect(document *Document) (Metadata, error)

Inspect reports rendering capabilities without creating a renderer's caches.

type MetadataOptions

type MetadataOptions = psdfile.MetadataOptions

MetadataOptions lowers the working budget for an owned placement or linked-content view.

type MixerChannel

type MixerChannel = psdadjust.MixerChannel

MixerChannel stores one output channel's coefficients and constant.

type NativeTextStateOptions

type NativeTextStateOptions = psdedit.NativeTextStateOptions

NativeTextStateOptions imports caller-supplied native text state, accurate layer artwork and document preview.

type Object

type Object = psdrender.Object

Object groups all visible instances of a linked smart object.

type ObjectConfig

type ObjectConfig = psdrender.ObjectConfig

ObjectConfig maps a smart object to a replacement image tag.

type OpenTypeClusterPaintPolicy

type OpenTypeClusterPaintPolicy = psdscene.OpenTypeClusterPaintPolicy

OpenTypeClusterPaintPolicy selects explicit approximate paint ownership for a whole UTF16 glyph cluster.

type OpenTypeFauxBoldPolicy

type OpenTypeFauxBoldPolicy = psdscene.OpenTypeFauxBoldPolicy

OpenTypeFauxBoldPolicy selects explicit approximate synthetic-weight layout.

type OpenTypeFeature

type OpenTypeFeature = psdfont.ShapeFeature

OpenTypeFeature explicitly enables or disables a selected optional font feature. Required LangSys features execute independently of these optional settings.

type OpenTypeShapeOptions

type OpenTypeShapeOptions = psdfont.ShapeOptions

OpenTypeShapeOptions selects Latin OpenType features and bounds shaping work. Optional features are disabled by default; Script and Language select one LangSys.

type OpenTypeStyleBoundaryPolicy

type OpenTypeStyleBoundaryPolicy = psdscene.OpenTypeStyleBoundaryPolicy

OpenTypeStyleBoundaryPolicy explicitly selects approximate shaping across source style boundaries.

type OpenTypeTextBluePolicy

type OpenTypeTextBluePolicy = psdscene.OpenTypeTextBluePolicy

OpenTypeTextBluePolicy selects explicit CFF1 source alignment-zone treatment.

type OpenTypeTextHinting

type OpenTypeTextHinting = psdscene.OpenTypeTextHinting

OpenTypeTextHinting selects an explicit approximate CFF1 source-hint fitting policy.

type OpenTypeTextKerning

type OpenTypeTextKerning = psdscene.OpenTypeTextKerning

OpenTypeTextKerning selects an explicit kerning policy for source text rendering.

type OpenTypeTextRenderOptions

type OpenTypeTextRenderOptions = psdscene.OpenTypeTextRenderOptions

OpenTypeTextRenderOptions bounds source metadata, layout and approximate coverage. Kerning must explicitly select None or Metrics; Shape selects optional font features.

type Options

type Options = psdrender.Options

Options controls input transparency trimming, output crops, format and longest-edge limits.

type PatternFill

type PatternFill = psdpattern.Fill

PatternFill contains a local pattern reference and supported periodic sampling controls.

type PatternFillEditOptions added in v0.2.0

type PatternFillEditOptions = psdedit.PatternFillEditOptions

PatternFillEditOptions supplies accurate artwork when editing known pattern parameters outside live sampling.

type PatternOptions

type PatternOptions = psdpattern.Options

PatternOptions bounds owned pattern rendering in absolute canvas coordinates.

type PhotoFilterParams

type PhotoFilterParams = psdadjust.PhotoFilterParams

PhotoFilterParams retains source-native filter color words, density and luminosity policy.

type PixelMaskSettings added in v0.2.0

type PixelMaskSettings = psdedit.PixelMaskSettings

PixelMaskSettings describes editable properties of an existing pixel mask.

type Placed

type Placed = psdmodel.Placed

Placed describes a smart-object instance and its saved transform metadata.

type Plane

type Plane = psdfile.Plane

Plane contains owned source-precision channel samples.

type Point

type Point = psdmodel.Point

Point is a double-precision canvas coordinate.

type PrecisionOptions

type PrecisionOptions = psdscene.PrecisionOptions

PrecisionOptions bounds ordinary source-precision layer composition and explicit non-finite policies.

type PresetWarpGeometry

type PresetWarpGeometry = psdwarp.PresetGeometry

PresetWarpGeometry owns validated forward and inverse coordinates for a supported Warp preset. Its mathematical pixel sampler requires explicit selection and does not claim native pixel equivalence.

func CompilePresetWarpGeometry

func CompilePresetWarpGeometry(
	ctx context.Context, placed *Placed, options ...WarpGeometryOptions,
) (*PresetWarpGeometry, error)

CompilePresetWarpGeometry prepares owned horizontal Arc Lower coordinates with validated source metadata. Compilation allocates no pixels; mathematical sampling is explicit and native sampling remains unverified. Scene rendering uses this certified subset only with explicit ApproximateCustomWarp; default projection is unchanged.

type ProfileTransformOptions

type ProfileTransformOptions = psdcolor.ProfileTransformOptions

ProfileTransformOptions bounds explicit RGB matrix/TRC conversion between two ICC profiles.

type RandomRow

type RandomRow = psdrender.RandomRow

RandomRow configures independent random replacements for one saved raster.

type RasterContentsOptions

type RasterContentsOptions = psdedit.RasterContentsOptions

RasterContentsOptions controls owned single-layer PSD/PSB construction from RGB8 pixels.

type RawSpan

type RawSpan = psdfile.Span

RawSpan identifies an unchanged interval of original source bytes.

type ReadError

type ReadError = psdfile.Error

ReadError describes a source feature, field path, byte offset and underlying failure.

type RegionDisplayOptions

type RegionDisplayOptions struct {
	Display DisplayOptions
	Decode  RegionOptions
}

RegionDisplayOptions controls color context and compressed-source work for a saved-image region.

type RegionOptions

type RegionOptions = psdfile.RegionOptions

RegionOptions bounds selected-region storage and complete compressed-stream validation work.

type RenderOptions

type RenderOptions = psdrender.RenderOptions

RenderOptions is an alternative name for Options.

type Renderer

type Renderer = psdrender.Engine

Renderer renders a borrowed immutable document and serializes concurrent calls. Render can return the document's composite buffer; treat all returned pixels as read-only.

func NewRenderer

func NewRenderer(document *Document) (*Renderer, error)

NewRenderer validates the supported RGB8 subset and borrows an immutable document. Unsupported features return an error wrapping ErrUnsupported.

type RenderingIntent

type RenderingIntent = psdcolor.RenderingIntent

RenderingIntent selects the source ICC forward transform.

type ResourceBlock

type ResourceBlock = psdfile.ResourceBlock

ResourceBlock describes an original image resource with its name, data and padding.

type SaveOptions

type SaveOptions = psdedit.SaveOptions

SaveOptions controls changed-channel compression, explicit composite input and output limits.

type SceneOptions

type SceneOptions = psdscene.Options

SceneOptions bounds live RGB8 rendering and explicit external content resolution. Certified horizontal Arc Lower presets require explicit ApproximateCustomWarp, including a zero bend.

type ShapedGlyph

type ShapedGlyph = psdfont.ShapedGlyph

ShapedGlyph retains a source UTF-16 span and advances and offsets in font design units.

type ShapedRun

type ShapedRun = psdfont.ShapedRun

ShapedRun owns shaped glyph IDs and positions without retaining the source font.

func ShapeOpenType

func ShapeOpenType(
	ctx context.Context, face *FontFace, text string, options ...OpenTypeShapeOptions,
) (*ShapedRun, error)

ShapeOpenType executes selected Latin single/ligature substitutions and pair positioning. It uses left-to-right horizontal layout; vertical advance adjustments are not applied. It does not execute Apple AAT, hinting, complex scripts, or implicit legacy kerning. The returned design-unit positions are independent of Photoshop layout and rasterization.

type Slice

type Slice = psdmodel.Slice

Slice describes a rectangular document crop.

type SmartContentsOptions

type SmartContentsOptions = psdedit.SmartContentsOptions

SmartContentsOptions selects explicit source-color and custom-Warp policies for content replacement.

type SmartFilter

type SmartFilter = psdfilter.Filter

SmartFilter contains one typed live filter operation.

type SmartFilterEditOptions

type SmartFilterEditOptions = psdedit.SmartFilterEditOptions

SmartFilterEditOptions selects automatic source rendering or accurate supplied artwork for filter parameter edits.

type SmartFilterEstimate

type SmartFilterEstimate = psdfilter.Estimate

SmartFilterEstimate reports retained output and peak additional filter storage.

func EstimateSmartFilters

func EstimateSmartFilters(source *image.NRGBA, stack SmartFilterPipeline,
	options ...SmartFilterOptions,
) (SmartFilterEstimate, error)

EstimateSmartFilters validates a pipeline and estimates peak additional storage before allocation.

type SmartFilterKind

type SmartFilterKind = psdfilter.Kind

SmartFilterKind identifies a live filter algorithm.

type SmartFilterOptions

type SmartFilterOptions = psdfilter.Options

SmartFilterOptions selects algorithms, explicit approximation and working limits.

type SmartFilterPipeline

type SmartFilterPipeline = psdfilter.Stack

SmartFilterPipeline retains a filter execution order and its whole-stack switch.

type SmartFilterRecord

type SmartFilterRecord = psdfile.SmartFilterRecord

SmartFilterRecord retains one original filter descriptor and its decoded live operation.

type SmartFilterStack

type SmartFilterStack = psdfile.SmartFilterStack

SmartFilterStack retains typed original placement descriptors and filter-mask controls.

func DecodeSmartFilters

func DecodeSmartFilters(ctx context.Context, placement SmartObjectRecord,
	options ...MetadataOptions,
) (*SmartFilterStack, error)

DecodeSmartFilters decodes an owned placement's filter controls without reading raster caches.

type SmartObjectInfo

type SmartObjectInfo = psdedit.SmartObjectInfo

SmartObjectInfo reports a placed layer's shared source and editable handle.

type SmartObjectRecord

type SmartObjectRecord = psdfile.SmartObjectRecord

SmartObjectRecord preserves modern placement metadata across source layer sets.

type SmartObjectView

type SmartObjectView = psdfile.SmartObjectView

SmartObjectView reports owned placements and their measured metadata reservation.

type SmartTransformOptions added in v0.2.0

type SmartTransformOptions = psdedit.SmartTransformOptions

SmartTransformOptions selects explicit source-color and projection policies for one placed instance.

type SmartWarpEditOptions added in v0.3.0

type SmartWarpEditOptions = psdedit.SmartWarpEditOptions

SmartWarpEditOptions selects explicit live source policies for one existing supported Warp edit.

type SmartWarpPresetParameters added in v0.3.0

type SmartWarpPresetParameters = psdedit.SmartWarpPresetParameters

SmartWarpPresetParameters changes the existing native bend while retaining its preset type and schema.

type SourceDocument

type SourceDocument = psdfile.Document

SourceDocument indexes original PSD/PSB bytes and owns its source until Close. Decode methods are explicit; indexing does not allocate pixel images.

func OpenDocument

func OpenDocument(filename string, options ...LoadOptions) (*SourceDocument, error)

OpenDocument indexes a PSD/PSB file and keeps it open until SourceDocument.Close. The optional LoadOptions configures resource limits; pixels remain encoded until requested.

func ParseDocument

func ParseDocument(data []byte, options ...LoadOptions) (*SourceDocument, error)

ParseDocument indexes and retains PSD/PSB bytes without copying their encoded payloads. Callers must keep the supplied bytes unchanged until SourceDocument.Close.

func ReadDocument

func ReadDocument(reader io.ReaderAt, size int64, options ...LoadOptions) (*SourceDocument, error)

ReadDocument indexes a borrowed ReaderAt; closing the document does not close reader. The caller keeps reader alive and immutable until all document operations finish.

type SourceLimits

type SourceLimits = psdfile.Limits

SourceLimits bounds files, metadata, raw reads and explicit pixel decoding.

func DefaultSourceLimits

func DefaultSourceLimits() SourceLimits

DefaultSourceLimits returns the default metadata and decode budgets.

type TIFFLayerSource

type TIFFLayerSource = psdfile.TIFFLayerSource

TIFFLayerSource borrows a Photoshop-private TIFF's saved layer channels and normalized metadata.

type TIFFLayerSourceInfo

type TIFFLayerSourceInfo = psdfile.TIFFLayerSourceInfo

TIFFLayerSourceInfo records private TIFF geometry, original spans and metadata reservation.

type TIFFNormalizationRange

type TIFFNormalizationRange = psdfile.TIFFNormalizationRange

TIFFNormalizationRange identifies typed byte-order reversals at original source offsets.

type TIFFOpaqueBlock

type TIFFOpaqueBlock = psdfile.TIFFOpaqueBlock

TIFFOpaqueBlock retains a private block with unavailable normalized semantics.

type TIFFSavedPreview

type TIFFSavedPreview = psdfile.TIFFSavedPreview

TIFFSavedPreview labels the original flattened main IFD image independently of private layer samples.

type TextEditOptions

type TextEditOptions = psdedit.TextEditOptions

TextEditOptions selects supplied artwork or explicit approximate rendering for a supported text edit.

type TextLayerRecord

type TextLayerRecord = psdfile.TextLayerRecord

TextLayerRecord contains ordered source text descriptors and lazy original EngineData.

type TextLayerView

type TextLayerView = psdfile.TextLayerView

TextLayerView reports the allocation reservation of owned text metadata.

type TextRenderOptions

type TextRenderOptions = psdscene.TextRenderOptions

TextRenderOptions controls explicitly requested approximate unhinted Latin glyph rendering.

type TileOptions

type TileOptions = psdscene.TileOptions

TileOptions bounds per-tile semantic snapshots, output, halo samples and decoder work. Certified preset sampling requires explicit ApproximateCustomWarp and the current call's external source mappings.

type UniformGridWarpGeometry

type UniformGridWarpGeometry = psdwarp.UniformGrid

UniformGridWarpGeometry owns a certified 10x10 or 13x13 uniform piecewise-cubic Warp. Compilation and projection do not consume saved placed-layer or composite pixels.

func CompileUniformGridWarpGeometry

func CompileUniformGridWarpGeometry(
	ctx context.Context, placed *Placed, options ...WarpGeometryOptions,
) (*UniformGridWarpGeometry, error)

CompileUniformGridWarpGeometry prepares a uniform split grid from preserved source metadata. Nonuniform slices, stale source dimensions and unqualified projective placement are rejected. The explicit raster model and Photoshop pixel acceptance remain separate from geometry certification.

type VectorEncodeOptions

type VectorEncodeOptions = psdvector.EncodeOptions

VectorEncodeOptions bounds owned path encoding.

type VectorMask

type VectorMask = psdvector.Mask

VectorMask contains owned Photoshop path records and editable document-space geometry.

type VectorOptions

type VectorOptions = psdvector.Options

VectorOptions bounds approximate filled-path rasterization.

type Warp

type Warp = psdmodel.Warp

Warp retains metadata used to detect unsupported Photoshop warp transforms.

type WarpBounds

type WarpBounds = psdmodel.WarpBounds

WarpBounds describes the bounds and coordinate units of a Photoshop warp descriptor.

type WarpGeometryOptions

type WarpGeometryOptions = psdwarp.Options

WarpGeometryOptions bounds retained geometry and inverse traversal.

type WarpSlice

type WarpSlice = psdmodel.WarpSlice

WarpSlice preserves the source coordinate domain of one native quilt slice column.

Directories

Path Synopsis
cmd
psdkit-wasm command
psdkit-web-build command
Command psdkit-web-build builds the browser executable and copies its matching Go runtime.
Command psdkit-web-build builds the browser executable and copies its matching Go runtime.
psdkit-web-docs command
Command psdkit-web-docs extracts original public Go contracts for the browser capability catalog.
Command psdkit-web-docs extracts original public Go contracts for the browser capability catalog.
psdkit-web-samples command
Command psdkit-web-samples packages the pinned apparel template and two original print assets.
Command psdkit-web-samples packages the pinned apparel template and two original print assets.
psdkit-web-server command
Command psdkit-web-server serves the static demo or assembled site and optional, loopback-only frozen browser fixtures.
Command psdkit-web-server serves the static demo or assembled site and optional, loopback-only frozen browser fixtures.
examples
color command
Command color exports source-precision saved previews or individual original layer planes as sRGB8 PNG.
Command color exports source-precision saved previews or individual original layer planes as sRGB8 PNG.
composite command
Command composite rebuilds an RGB8 PSD/PSB layer tree and exports straight-alpha PNG pixels.
Command composite rebuilds an RGB8 PSD/PSB layer tree and exports straight-alpha PNG pixels.
create command
Example create writes a new editable transparent RGB8 PSD or PSB.
Example create writes a new editable transparent RGB8 PSD or PSB.
edit command
Command edit renames or edits a layer and atomically saves an editable PSD/PSB.
Command edit renames or edits a layer and atomically saves an editable PSD/PSB.
index command
Command index inspects original PSD/PSB blocks and optionally decodes one layer or the composite.
Command index inspects original PSD/PSB blocks and optionally decodes one layer or the composite.
inspect command
Command inspect reports a PSD's dimensions, feature counts and rendering capabilities.
Command inspect reports a PSD's dimensions, feature counts and rendering capabilities.
placed-layer command
Command placed-layer renders one original placed layer and its effects onto a transparent parent-sized image.
Command placed-layer renders one original placed layer and its effects onto a transparent parent-sized image.
precision command
Command precision rebuilds ordinary high-depth PSD layers without eight-bit conversion.
Command precision rebuilds ordinary high-depth PSD layers without eight-bit conversion.
render command
Command render replaces visible raster smart objects and exports one PNG or JPEG preview.
Command render replaces visible raster smart objects and exports one PNG or JPEG preview.
replace-contents command
Command replace-contents updates an embedded smart-object PSD/PSB and all its shared instances.
Command replace-contents updates an embedded smart-object PSD/PSB and all its shared instances.
scene command
Example scene rebuilds an RGB8 PSD/PSB including its embedded placed PSD/PSB documents.
Example scene rebuilds an RGB8 PSD/PSB including its embedded placed PSD/PSB documents.
internal
canvaspix
Package canvaspix preserves the frontend's eight-bit Canvas export quantization.
Package canvaspix preserves the frontend's eight-bit Canvas export quantization.
psdartboard
Package psdartboard shares bounded retained-artboard validation and owned composition snapshots.
Package psdartboard shares bounded retained-artboard validation and owned composition snapshots.
psdplaced
Package psdplaced carries private candidate placement inputs between editing and source rendering.
Package psdplaced carries private candidate placement inputs between editing and source rendering.
psdrendered
Package psdrendered binds a scene-generated raster to its placement and absolute geometry.
Package psdrendered binds a scene-generated raster to its placement and absolute geometry.
psdrgb16normal
Package psdrgb16normal contains the calibrated encoded RGB16 Normal pixel arithmetic.
Package psdrgb16normal contains the calibrated encoded RGB16 Normal pixel arithmetic.
testfixture
Package testfixture locates optional large test assets outside the source repository.
Package testfixture locates optional large test assets outside the source repository.
webfixtures
Package webfixtures constructs small, original test assets for browser protocol verification.
Package webfixtures constructs small, original test assets for browser protocol verification.
Package psdadjust applies bounded RGB8 tonal adjustments without changing source pixels or alpha.
Package psdadjust applies bounded RGB8 tonal adjustments without changing source pixels or alpha.
Package psdcolor converts original PSD channel samples to owned, straight-alpha sRGB pixels.
Package psdcolor converts original PSD channel samples to owned, straight-alpha sRGB pixels.
Package psdcompose rebuilds RGB8 document pixels from decoded layer trees.
Package psdcompose rebuilds RGB8 document pixels from decoded layer trees.
Package psdedit applies controlled layer edits and saves PSD/PSB documents while preserving source blocks.
Package psdedit applies controlled layer edits and saves PSD/PSB documents while preserving source blocks.
Package psdeffects interprets modern RGB layer-effect descriptors and rasterizes bounded effect coverage.
Package psdeffects interprets modern RGB layer-effect descriptors and rasterizes bounded effect coverage.
Package psdfile indexes original PSD/PSB structures and decodes pixels on demand.
Package psdfile indexes original PSD/PSB structures and decodes pixels on demand.
Package psdfilter executes bounded RGB8 smart-filter pipelines without saved raster caches.
Package psdfilter executes bounded RGB8 smart-filter pipelines without saved raster caches.
Package psdfont reads supplied TrueType, CFF1 and CFF2 fonts and defaults to unhinted Latin layout.
Package psdfont reads supplied TrueType, CFF1 and CFF2 fonts and defaults to unhinted Latin layout.
Package psdgradient renders bounded classic RGB gradient fills in document coordinates.
Package psdgradient renders bounded classic RGB gradient fills in document coordinates.
Package psdmodel defines decoded document data shared by PSD readers and renderers.
Package psdmodel defines decoded document data shared by PSD readers and renderers.
Package psdparse reads bounded RGB8 Photoshop documents without native libraries or browser processes.
Package psdparse reads bounded RGB8 Photoshop documents without native libraries or browser processes.
Package psdpattern repeats owned RGB8 pattern tiles in document coordinates without converting ICC profiles.
Package psdpattern repeats owned RGB8 pattern tiles in document coordinates without converting ICC profiles.
Package psdprecision composites finite source colors without eight-bit quantization or HDR clipping.
Package psdprecision composites finite source colors without eight-bit quantization or HDR clipping.
Package psdrender renders the editor's supported PSD subset using straight-alpha Go pixels.
Package psdrender renders the editor's supported PSD subset using straight-alpha Go pixels.
Package psdscene rebuilds bounded RGB8 documents and recursively resolves placed PSD/PSB content.
Package psdscene rebuilds bounded RGB8 documents and recursively resolves placed PSD/PSB content.
Package psdtext decodes and preserves Photoshop's text EngineData metadata.
Package psdtext decodes and preserves Photoshop's text EngineData metadata.
Package psdvector decodes retained Photoshop path records and rasterizes filled vector masks.
Package psdvector decodes retained Photoshop path records and rasterizes filled vector masks.
Package psdwarp evaluates certified single-patch custom PSD warps with affine placement.
Package psdwarp evaluates certified single-patch custom PSD warps with affine placement.
Package psdweb exposes bounded, in-memory psdkit operations to browser workers and native tests.
Package psdweb exposes bounded, in-memory psdkit operations to browser workers and native tests.
scripts

Jump to

Keyboard shortcuts

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