imageupscaler

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 9 Imported by: 0

README

Neuron Nexus Image Upscale

Neuron Nexus Image Upscale is a Go framework for upscaling images. It allows you to frame the original image to fit a custom aspect ratio. The framework allows you to place the image in a frame with the original color (white) or in a frame of a custom color. Images can be imported in .png, .jpg and .gif. Export is available in .png and .jpg.

Installation

go get -u github.com/neuron-nexus/go-image-upscaler

Usage (v1.0.1)

package main

import (
	"image/color"
	"log"
	"os"

	imageupscaler "github.com/neuron-nexus/go-image-upscaler"
)

func main() {
	upscaler := imageupscaler.New()
	err := upscaler.SetImage("./test.jpg")
	if err != nil {
		log.Fatal(err)
	}

	file, err := os.Create("./test2.jpg")
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()

	//upscaler.Upscale(3, 2)
	upscaler.UpscaleWithColor(3, 2, color.RGBA{172, 25, 135, 255})
	upscaler.Render(imageupscaler.JPG, file, nil)
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JPG = ImageType{/* contains filtered or unexported fields */}
	PNG = ImageType{/* contains filtered or unexported fields */}
)
View Source
var (
	ErrorIncorrectImageType = errors.New("incorrect image type. Use JPG or PNG")
)

Functions

This section is empty.

Types

type ImageType

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

type Upscaler

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

func New

func New() *Upscaler

func (*Upscaler) Render

func (u *Upscaler) Render(imgType ImageType, file io.Writer, o *jpeg.Options) error

func (*Upscaler) SetImage

func (u *Upscaler) SetImage(path string) error

func (*Upscaler) Upscale

func (u *Upscaler) Upscale(widthRatio, heightRatio int)

func (*Upscaler) UpscaleWithColor

func (u *Upscaler) UpscaleWithColor(widthRatio, heightRatio int, clr color.RGBA)

Jump to

Keyboard shortcuts

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