Documentation ¶
Index ¶
- func Apply(r io.Reader) (image.Image, error)
- func Decode(r io.Reader) (image.Image, error)
- func Orient(img image.Image, tag int) (image.Image, error)
- func Orient1(s image.Image) image.Image
- func Orient2(s image.Image) image.Image
- func Orient3(s image.Image) image.Image
- func Orient4(s image.Image) image.Image
- func Orient5(s image.Image) image.Image
- func Orient6(s image.Image) image.Image
- func Orient7(s image.Image) image.Image
- func Orient8(s image.Image) image.Image
- func SwapSides(r image.Rectangle) image.Rectangle
- func Tag(r io.Reader) (int, error)
- type DecodeError
- type FormatError
- type OrientError
- type TagError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply reflects the image's EXIF orientation tag on the image pixels. If the image can not be decoded, it returns nil and an error. If an error occurs during subsequent processing, it returns the decoded image and an error.
func Decode ¶
Decode decodes and returns the image. If decoding fails, it returns nil and DecodeError. If the format is not JPEG, it returns the decoded image and FormatError.
func Orient ¶
Orient reflects the rotation indicated by the tag in the img. If the specified orientation tag is unknown, returns OrientError.
func Orient2 ¶
Orient2 returns a new image in which the right side replaced by the left side. Process like this:
111 111 001 100 011 -> 110 001 100 001 100
func Orient3 ¶
Orient3 returns a new image in which the bottom side is replaced by the upper side and the right side replaced by the left side. Process like this:
001 111 001 100 011 -> 110 001 100 111 100
func Orient4 ¶
Orient4 returns a new image in which the bottom side is replaced by the upper side. Process like this:
100 111 100 100 110 -> 110 100 100 111 100
func Orient5 ¶
Orient5 returns a new image in which the left side is replaced by the upper side and the upper side is replaced by the left side. Process like this:
111 11111 100 10100 -> 110 10000 100 100
func Orient6 ¶
Orient6 returns a new image in which the left side is replaced by the upper side and the bottom side is replaced by the left side. Process like this:
111 10000 100 10100 -> 110 11111 100 100
func Orient7 ¶
Orient7 returns a new image in which the right side is replaced by the upper side and the bottom side is replaced by the left side. Process like this:
111 00001 100 00101 -> 110 11111 100 100
func Orient8 ¶
Orient8 returns a new image in which the right side is replaced by the upper side and the upper side is replaced by the left side. Process like this:
111 11111 100 00101 -> 110 00001 100 100
Types ¶
type DecodeError ¶
type DecodeError struct {
Raw error
}
DecodeError is returned by Apply and Decode when image.Decode returns an error.
func (*DecodeError) Cause ¶
func (e *DecodeError) Cause() error
Cause returns the underlying cause of DecodeError.
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
type FormatError ¶
type FormatError struct {
Raw error
}
FormatError is returned by Apply and Decode when the format of decoded image is not jpeg.
func (*FormatError) Cause ¶
func (e *FormatError) Cause() error
Cause returns the underlying cause of FormatError.
func (*FormatError) Error ¶
func (e *FormatError) Error() string
type OrientError ¶
type OrientError struct {
Raw error
}
OrientError is returned by Apply and Tag when the specified orientation tag is unknown.
func (*OrientError) Cause ¶
func (e *OrientError) Cause() error
Cause returns the underlying cause of OrientError.
func (*OrientError) Error ¶
func (e *OrientError) Error() string