image

package
v0.45.11 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Image (de)coding and processing magic package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CropToSquare

func CropToSquare(img *image.Image) *image.Image

CropToSquare crops an image to a 1:1 aspect ratio (square)

func DecodeImage

func DecodeImage(imgData *[]byte, extInput string) (*image.Image, string, error)

DecodeImage decodes a byte stream to an image

func EncodeImage

func EncodeImage(img *image.Image, format string) (*[]byte, error)

EncodeImage encodes an image back to byte stream (JPEG or PNG)

func FixOrientation

func FixOrientation(img *image.Image, imgBytes *[]byte) (*image.Image, error)

FixOrientation checks the EXIF orientation tag and corrects the image's orientation if necessary

func ProcessImageBytes added in v0.44.26

func ProcessImageBytes(data *ImageProcessPayload) (*string, error)

func ProcessPost added in v0.44.26

func ProcessPost(post *models.Post, postContent *string) (error, int)

func ResizeImage

func ResizeImage(img *image.Image, targetWidth int) image.Image

ResizeImage resizes an image to a target width and height while maintaining aspect ratio

Types

type ImageProcessPayload added in v0.44.26

type ImageProcessPayload struct {
	ImageByteData *[]byte
	ImageFileName string
	ImageBaseName string
}

Jump to

Keyboard shortcuts

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