Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Contest Painting Effects

This is a Go image processing library that perfectly recreates the Pokémon Contest painting effects found in Pokémon Emerald, Ruby, and Sapphire. The code is directly ported from the pokeemerald project.

Examples:

Charizard Arcanine

The full dump of all possible Pokémon Contest Painting images can be downloaded here: https://www.mediafire.com/file/y59hxgd4thtk6z3/contest-painting-pokemon.zip/file

A full working example of using this library is found below. It processes the given image with the "Smart Contest" effect.

package main

import (
	"fmt"
	"image"
	"image/png"
	_ "image/png"
	"log"
	"os"

	contestpaintingeffects "github.com/huderlem/contest-painting-effects"
	"github.com/huderlem/contest-painting-effects/canvas"
)

func loadImage() (image.Image, error) {
	imageFile, err := os.Open("dusclops.png")
	if err != nil {
		return nil, fmt.Errorf("Error opening input image file: %s", err.Error())
	}
	defer imageFile.Close()

	imageData, _, err := image.Decode(imageFile)
	if err != nil {
		return nil, fmt.Errorf("Error decoding image file: %s", err.Error())
	}
	return imageData, nil
}

func saveImage(img image.Image) error {
	outputFile, err := os.Create("output.png")
	if err != nil {
		return fmt.Errorf("Error saving image: %s", err.Error())
	}
	defer outputFile.Close()

	png.Encode(outputFile, img)
	return nil
}

func main() {
	imageData, err := loadImage()
	if err != nil {
		log.Fatalf(err.Error())
	}

	c := canvas.FromImage(imageData)
	palette := contestpaintingeffects.ApplySmartEffect(c)
	saveImage(c.ToImage(palette))
}

About

Image processing library for Pokémon Contest paintings found in Gen 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages