imgrow

package module
v0.0.0-...-6b28505 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 3 Imported by: 1

README

go-imgrow

Package imgrow provides tools for growing and image by an integer value.

For example — if you have an image, then you make it 2× bigger, or 3× bigger, or 4× bigger, etc.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-imgrow

GoDoc

Example:

import "sourcecode.social/reiver/go-imgrow"

// ...

var originalImage image.Image = ...

// ...

var scalar int = 400 // change this value to how many times bigger you want the image to be. here it is 400× bigger.

var newImage image.Image = imgrow(scalar, originalImage)

Import

To import package imgrow use import code like the follownig:

import "sourcecode.social/reiver/go-imgrow"

Installation

To install package imgrow do the following:

GOPROXY=direct go get https://sourcecode.social/reiver/go-imgrow

Author

Package imgrow was written by Charles Iliya Krempeaux

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawImage

func DrawImage(scalar int, img draw.Image) draw.Image

DrawImage returns an image that is 'img' where (only) drawing is scalad by 'scalar'. The actual image stays the same size. Only the drawing is scaled.

So, for example:

var newImage draw.Image = imgrow.Image(2, oldImage)

... would return a new image that is just like 'oldImage' except any drawing on it is 2 times as big.

Note that if you are trying to try a complex object and want the top-left corner to be at the original (unscaled) (x,y) rather (rather than the scaled position) then you need to move the top-left corner to:

xAdjusted := x / scalar
yAdjusted := y / scalar

func Image

func Image(scalar int, img image.Image) image.Image

Image returns an image that is 'img' scalad by 'scalar'.

So, for example:

var newImage image.Image = imgrow.Image(2, oldImage)

... would return a new image that is just like 'oldImage' except that it is 2 times as big.

Types

This section is empty.

Jump to

Keyboard shortcuts

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