Skip to content
Image processing library for Pokémon Contest paintings found in Gen 3
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
canvas
effect
paletteq
pixelq
README.md
arcanine-example.png
charizard-example.png
contestpaintingeffects.go
go.mod

README.md

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))
}
You can’t perform that action at this time.