Skip to content

A go implementation of a procedural pixel art algorithm

License

Notifications You must be signed in to change notification settings

NotSoSeriouss/imager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Imager

Imager is a Go library for generating image matrices based on a given template image. It allows you to create pixel matrices with customizable settings such as mirroring, fading, and seeding for randomness.

Features

  • Generate procedurally pixel matrices from template images.
  • Customize mirroring along the X and Y axes.
  • Seed for deterministic randomness.
  • Adjustable dark gradient (Fading)

Coming soon

  • Fading on any any angle (Right now it only works on the X axys)
  • Use matrices instead of an image as the input

Installation

To install Imager, use go get:

go get github.com/NotSoSeriouss/imager

Usage

package main

import (
	"fmt"
	"github.com/NotSoSeriouss/imager"
)

func main() {
	// Define settings
	settings := imager.Settings{
		MirrorY: true,
		MirrorX: false,
		Fade:    50, // At 50, the lowest pixel in the y
                             // axys will have removed 50 pt from its brightness
		Seed:    12345, // Use 1 instead to have a random seed
	}

	// Define color
	color := imager.Rcolor(1.0) // Random color with full opacity

	// Generate pixel matrix
	pixelMatrix := imager.Generate("path/to/template/image.png", color, settings)

	// Do something with pixelMatrix...
	fmt.Println(pixelMatrix)
}

Template Image

template (Here the image is in half because this template is meant to be mirrored)

To create a template image:

  • Use PNG or JPEG format.
  • Use the following color scheme:
    • Red (255,0,0): Border
    • Green (0,255,0): Body
    • Yellow (255,255,0): Border/Body
    • Magenta (255,0,255): Border/Empty
    • Cyan (0,255,255): Empty/Body
    • Anything else: Empty

Example Results

2024-05-01-021708_3000x2000_scrot 2024-05-01-021703_3000x2000_scrot 2024-05-01-021700_3000x2000_scrot 2024-05-01-021659_3000x2000_scrot 2024-05-01-021656_3000x2000_scrot

Contributing

Contributions are welcome! Fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A go implementation of a procedural pixel art algorithm

Topics

Resources

License

Stars

Watchers

Forks

Languages