ora

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ora opens OpenRaster and Krita files.

Both formats are zip archives that hold the layers of an image and the merged image, mergedimage.png. A document has one page, the merged image, and gives the thumbnail of the file as its preview (D11). A Krita file describes itself in documentinfo.xml: its title, its author, its subject, its language and its dates. The stack.xml of OpenRaster holds no such facts, only the size of the image and its layers. The package also registers both formats with the package image, so that image.Decode reads the merged image.

Index

Constants

This section is empty.

Variables

View Source
var Format = ivy.Format{
	Name:  "ora",
	Mimes: []string{mimeORA, mimeKrita},
	Exts:  []string{"ora", "kra"},
	Open: func(ctx context.Context, src ivy.Source, cfg ivy.Config) (ivy.Document, error) {
		return Open(ctx, src, WithConfig(cfg))
	},
}

Format describes the package for the registry of a program.

Functions

func Decode

func Decode(r io.Reader) (image.Image, error)

Decode reads an OpenRaster or a Krita file from r, and returns its merged image. It reads at most ivy.DefaultMaxMemory bytes.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

DecodeConfig returns the size of the merged image of the OpenRaster or Krita file in r, and the color model of a PNG image.

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document is an open OpenRaster or Krita file.

func Open

func Open(ctx context.Context, src ivy.Source, opts ...Option) (*Document, error)

Open opens an OpenRaster or a Krita file. It returns an error that wraps ivy.ErrFormat if src is neither.

func (*Document) Close

func (d *Document) Close() error

Close satisfies the ivy.Document interface.

func (*Document) Describe

func (d *Document) Describe(ctx context.Context) (ivy.Info, error)

Describe satisfies the ivy.Describer interface. It reads the documentinfo.xml of a Krita file. An OpenRaster file has no facts.

func (*Document) Mime

func (d *Document) Mime() string

Mime returns the mime type that the file declares: "image/openraster" or "application/x-krita".

func (*Document) Page

func (d *Document) Page(_ context.Context, n int) (ivy.Page, error)

Page satisfies the ivy.Pager interface. Page 0 is the merged image.

func (*Document) PageCount

func (d *Document) PageCount(context.Context) (int, error)

PageCount satisfies the ivy.Pager interface. A file has one page.

func (*Document) Previews

func (d *Document) Previews(ctx context.Context) iter.Seq2[ivy.Preview, error]

Previews satisfies the ivy.Previewer interface. It lists the thumbnail of an OpenRaster file, or the preview of a Krita file.

type Option

type Option func(*options)

Option is an option of Open.

func WithConfig

func WithConfig(cfg ivy.Config) Option

WithConfig sets the configuration that every format shares.

Jump to

Keyboard shortcuts

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