Pages: 1
Posted on 01-23-25, 03:57 pm


Karma: 73
Posts: 2/2
Since: 01-22-25

Download the PDF here!

I wrote this guide on how to use NitroPaint to import tileset graphics into NSMBDS without color depth loss
Tilesets on NSMB can look so much better with this method.


(Overlaying the NitroPaint Version on top of the old NSMBe one)
Posted on 03-01-25, 07:02 pm
Paragoomba


Karma: 353
Posts: 74/76
Since: 03-04-19
I wrote a script with AI for those who aren't use Aseprite.
Save the code below in a python script and run the following command:

python extract_palette_image.py <path_to_your_image.png> <output_palette_image_prefix>

A palette for each bitmap in the image is created.

import sys
from PIL import Image
import numpy as np


def extract_colors(image, max_colors=256):
pixels = np.array(image)

# Reshape the array and get the unique colors
pixels = pixels.reshape(-1, pixels.shape[-1])
unique_colors, counts = np.unique(pixels, axis=0, return_counts=True)

# Sort colors by frequency (most common first)
sorted_colors = unique_colors[np.argsort(-counts)]

# Limit to the max number of colors
selected_colors = sorted_colors[:max_colors]

return selected_colors


def save_palette_image(colors, output_path, width=16, height=16):
image = Image.new("RGBA", (width, height), (0, 0, 0, 0)) # Create a transparent image

# Fill the image with the palette colors
for i, color in enumerate(colors):
if i >= width * height:
break
x = i % width
y = i // width
image.putpixel((x, y), tuple(color))

image.save(output_path)


if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: python extract_palette_image.py <input_image_path> <output_palette_image_prefix>")
sys.exit(1)

input_image_path = sys.argv[1]
output_palette_image_prefix = sys.argv[2]

image = Image.open(input_image_path).convert("RGBA")
width, height = image.size

for i in range(0, height, 112):
section = image.crop((0, i, 256, min(i + 112, height)))
colors = extract_colors(section)

# Save first palette image
output_path_1 = f"{output_palette_image_prefix}_{i // 112}_1.png"
save_palette_image(colors[:256], output_path_1)

# Save second palette image if more than 256 colors
if len(colors) > 256:
output_path_2 = f"{output_palette_image_prefix}_{i // 112}_2.png"
save_palette_image(colors[256:], output_path_2)

print("Palettes saved with prefix", output_palette_image_prefix)
Posted on 03-01-25, 08:36 pm
Mole
Goomba's run the world...

Karma: 463
Posts: 294/358
Since: 08-27-20
Heck yeah, was working on a few tilesets earlier. This should help out a lot man
_________________________


Hacks Channel:
https://www.youtube.com/channel/UCqA5CgsW-CTfD56DCa2kvYw/channels
Posted on 05-17-25, 10:58 pm
Flurry
Unfortunately, where there is light, there is dark. Where there's a Star, there's a Ztar!

Karma: 1022
Posts: 256/262
Since: 02-02-24
This is a very useful and easy to understand tutorial, with this method, tilesets can look much cleaner and more organized, however, just a little heads up for anyone following this tutorial, the PDF says that you need Aseprite to generate the palettes, but Aseprite is not necessary at all, you can just right click the character editor in Nitro Paint, select "Import bitmap here", and Nitro Paint will automatically generate the palettes for you


Repeat this procedure with all the other palettes until all the colors are generated in all the palettes.

Also, bare in mind that this tutorial doesn't only apply to tilesets, this method can also work with any file in the game that works with palettes, like powerups and uiStudio files for example, but some steps may be different depending of the file you're editing.
_________________________

My YouTube Channel NSMB Central Discord Server
Pages: 1