img

package module
v0.0.0-...-f3c0e34 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

README

img

Go Reference

Drop-in functionality for decoding and encoding images, with some sugar added, including:

  • Metadata preservation
  • JPEG auto-rotation

This is useful for building consumer-facing services and tools that manipulate images without losing important data along the way. Above all, this aims to fill a void left by the standard Go library, where manipulating images also means losing their metadata.

Goals

This aims to support basic functions around image manipulation in a pure Go implementation. This library was built for Snap.as, and will eventually become a part of WriteFreely.

HELP!

Frankly, I don't really know what I'm doing. I read Wikipedia, skim the spec, fork some code, and bang on it until it works. I could use some professional help developing this into a rock-solid library. So if you know image formats, please reach out, and I will pay you to help make that happen.

License

BSD 3-Clause License. Copyright 2021 A Bunch Tell LLC, and respective authors of libraries included herein.

Documentation

Overview

Package img enables basic image operations with automatic features like orientation correction and EXIF / ICC profile preservation, so you can transform photos without losing important metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	Image image.Image
	App2  []byte
	// contains filtered or unexported fields
}

Image contains an image.Image plus any metadata we want to preserve through future image transformations.

func Decode

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

Decode decodes an image and changes its orientation according to the EXIF orientation tag (if present), while also preserving any ICC profile (APP2 data) in the returned Image.

func (Image) Bytes

func (i Image) Bytes() []byte

Bytes returns a slice of length i.Len() holding the unread portion of the Image's buffer.

func (Image) Len

func (i Image) Len() int

Len returns the number of bytes of the unread portion of the Image's buffer.

func (Image) Write

func (i Image) Write(p []byte) (n int, err error)

Write appends the contents of p to the Image's buffer.

Directories

Path Synopsis
Package iccjpeg implements ICC profile extraction from JPEG files.
Package iccjpeg implements ICC profile extraction from JPEG files.
Package jpeg implements a JPEG image decoder and encoder.
Package jpeg implements a JPEG image decoder and encoder.

Jump to

Keyboard shortcuts

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