Tiled palette quantization tool

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.
Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
SNES AYE
Posts: 370
Joined: Mon Nov 07, 2022 11:28 am

Re: Tiled palette quantization tool

Post by SNES AYE »

Hi, Rilden. I've sent you a PM regarding a few bugs that have been introduced since the last build. If you need any further feedback, feel free to PM me.
I am neurodivergent, so if any of my posts unintentionally upset you, I apologize.
turboxray
Posts: 390
Joined: Thu Oct 31, 2019 12:56 am

Re: Tiled palette quantization tool

Post by turboxray »

Rilden wrote: Thu Jan 04, 2024 1:31 pm I made some changes to the color quantization algorithm. Now your image is converted with 0 error using only 3 palettes of 16 colors. I didn't test thoroughly, so you should check to see if the conversion became worse with other images.
3pal_0_error.png

I tested on an image with a smooth gradient and the new method visibly improves quantization compared to before:
Before:
16pal_old.png
After:
16pal_new.png
Now the image with 16 palettes of 15 colors looks almost as good as an image with a single 240 color palette.
Ohh wow! That was fast hahah.

"so you should check to see if the conversion became worse with other images."
I have run like 600-700 images through TQ and some of quite a few times. I have a saved stash of them, so I can do a mini regression this weekend or next week. Thanks!
turboxray
Posts: 390
Joined: Thu Oct 31, 2019 12:56 am

Re: Tiled palette quantization tool

Post by turboxray »

I did a regression with a bunch of images... different palette sizes, color depths, tile sizes, etc. It's definitely an improvement and I didn't notice any oddities. I did notice the "Fraction of pixels" is more sensitive now and lower values seem to have replaced using larger values of the older TQ; before I would set it to 9.1 but now I'd set it to like 3.1 or so.
SNES AYE
Posts: 370
Joined: Mon Nov 07, 2022 11:28 am

Re: Tiled palette quantization tool

Post by SNES AYE »

Hmmm, that's strange, because the few bugs I noticed when I quickly tested it previously were still there when I just tried it a minute ago too.

During your most recent tests, you didn't notice that the palette indicators off to the side of the converted images display incorrect and/or missing colours, that when you left click to download an image and then view it in a program like Photoshop it can often be corrupted with what looks like inverted colours, and that sometimes large flat areas of colour are now adding dithering in the converted version?

The last one I can't be 100% sure is a new issue or even not entirely intended, because I can't try the old build now to confirm 100% that it wasn't ever doing what it's doing in the new version, but I didn't notice it previously when I was converting images with large areas of flat colour.

Either way, I'm sure Rilden will check it all out when he gets some time and figure out what the situation is there.
I am neurodivergent, so if any of my posts unintentionally upset you, I apologize.
turboxray
Posts: 390
Joined: Thu Oct 31, 2019 12:56 am

Re: Tiled palette quantization tool

Post by turboxray »

I noticed no issues with the file outputs; no missing colors or corruptions. Matter of fact, they open fine on both photoshop (most recent version) and my own gui image editing app. They also appear correct for the app that takes these are an input, and outputs to the native system format (snes, pce. md, etc). Maybe it's your browser or old version of photoshop, but I experienced no issues. Or maybe you're not letting the app finish the image processing?
Rilden
Posts: 21
Joined: Wed Jun 22, 2022 5:34 am

Re: Tiled palette quantization tool

Post by Rilden »

There is a bug in the current version when using transparent from transparent pixels, or transparent color. I will try to fix this issue, in the meantime you can use the old version at this address: https://rilden.github.io/tiledpalettequant/v0.1/
SNES AYE
Posts: 370
Joined: Mon Nov 07, 2022 11:28 am

Re: Tiled palette quantization tool

Post by SNES AYE »

Thanks for linking to the old version in the meantime, Rilden. I had a small panic that my current work might be stopped dead in its tracks if it were just a known aspect of the tool that didn't quite fit with the way I was using it, which I guess is maybe not exactly the expected use case. This tool has proved invaluable to me personally. I look forward to any new version.
I am neurodivergent, so if any of my posts unintentionally upset you, I apologize.
User avatar
Nikku4211
Posts: 616
Joined: Sun Dec 15, 2019 1:28 pm
Location: Bronx, NY

Re: Tiled palette quantization tool

Post by Nikku4211 »

So I found out about SNES pseudo hi-res being able to have different attributes and palettes for even and odd pixel columns.

Took a look at the tool's Javascript code, and it still leaves me wondering how to add support for this to the tool.
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.
Rilden
Posts: 21
Joined: Wed Jun 22, 2022 5:34 am

Re: Tiled palette quantization tool

Post by Rilden »

Rilden wrote: Thu Jan 11, 2024 4:57 am There is a bug in the current version when using transparent from transparent pixels, or transparent color. I will try to fix this issue, in the meantime you can use the old version at this address: https://rilden.github.io/tiledpalettequant/v0.1/
I fixed this bug. Generating images using transparent from transparent pixels, or transparent color should work correctly.
GValiente
Posts: 34
Joined: Mon Sep 12, 2022 12:17 am

Re: Tiled palette quantization tool

Post by GValiente »

Rilden wrote: Sun Feb 11, 2024 9:33 am I fixed this bug. Generating images using transparent from transparent pixels, or transparent color should work correctly.
Thanks!
psycopathicteen
Posts: 3198
Joined: Wed May 19, 2010 6:12 pm

Re: Tiled palette quantization tool

Post by psycopathicteen »

Rilden wrote: Sun Sep 04, 2022 12:54 pm I made a new tool that converts images to 8 palettes with 4bpp. You can try it out here: https://rilden.github.io/tiledpalettequant/. For snes select 16 colors per palette, and shared color zero. Drag an image over the webpage and press Quantize. You can click on the generated images to save them.
Does this use JavaScript? I was trying to follow a tutorial on how to do pixel manipulation, but I was getting a "cross origin" error, when I tried to turn a PNG into an array.
buckyohare
Posts: 6
Joined: Sat Feb 22, 2025 4:45 pm

Re: Tiled palette quantization tool

Post by buckyohare »

Rilden wrote: Sun Sep 04, 2022 12:54 pm I made a new tool that converts images to 8 palettes with 4bpp. You can try it out here: https://rilden.github.io/tiledpalettequant/. For snes select 16 colors per palette, and shared color zero. Drag an image over the webpage and press Quantize. You can click on the generated images to save them.
You can include a "palletes per tile" option?
93143
Posts: 1916
Joined: Fri Jul 04, 2014 9:31 pm

Re: Tiled palette quantization tool

Post by 93143 »

You mean for superimposing multiple layers?
User avatar
olddb
Posts: 198
Joined: Thu Oct 26, 2017 12:29 pm

Re: Tiled palette quantization tool

Post by olddb »

Rilden wrote: Sun Sep 04, 2022 12:54 pm I made a new tool that converts images to 8 palettes with 4bpp. You can try it out here: https://rilden.github.io/tiledpalettequant/. For snes select 16 colors per palette, and shared color zero. Drag an image over the webpage and press Quantize. You can click on the generated images to save them.
This is great. Haven't look at the code, but why does it need a server to run?
...
lidnariq
Site Admin
Posts: 11803
Joined: Sun Apr 13, 2008 11:12 am

Re: Tiled palette quantization tool

Post by lidnariq »

olddb wrote: Thu Oct 16, 2025 7:11 pm This is great. Haven't look at the code, but why does it need a server to run?
It doesn't - it runs entirely in javascript. You can save the HTML file and multiple js files locally and it'll work too.

https://github.com/rilden/tiledpalettequant