Jump to content
izb

New community dev tool uploaded: 12-bit palette script for Aseprite

Recommended Posts

12-bit palette script for Aseprite

View File

Aseprite script that converts the current palette into a 12-bit (4096 colour) palette, i.e. 4-bits per channel.

To install in Aseprite, go to File -> Scripts -> Open scripts folder

Then drop the script into that folder and restart Aseprite. You might also want to assign a hotkey to the script via Edit -> Keyboard Shortcuts. 

It's also useful for things like creating gradients. Just create a gradient in the normal way, then run the script, and each colour in the palette will be nudged into the closest CX16 colour.


 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I've used this script for a while now, thanks a lot for this. I'm think I stumbled across something in regards to the conversion.
As it's a bit complicated I'll try to explain it:

Colors appear different in emulator:

Recently I noticed that the colors in the emulator appear slightly different than in Aseprite (using your script). Looking at the script it appears it rounds everything to a palette entry ending with "0" for each rgb value:
0x00, 0x10, 0x20, 0x30... 0xE0, 0xFF << you can see here that there is a gap of 31 values at then end and 16 in between all others...

The emulator produces each entry mostly with the same hex digits for each tuple (using screenshots and Gimp to determine color values). So:
0x00, 0x11, 0x22, 0x33... 0xEE, 0xFF << here the gap is 17 between each color value.

why this can be an issue:

The script currently adds 8 and then discards the lower nibble. I think the thresholds for each of the 16 values per color value needs to be different. Right now there is a big gap in the brighter colors, which leads to color bleeding towards the slightly dimmer ones.

Script algorithm changes:

What I have done now is to change the script slightly and emit the above RGB values, so Gimp, Pro Motion, Aseprite etc. show the right colors (as the emulator would) and also use those for dithering. Of course VERA then can only use the upper 4 bits of each palette entry. Tools like Aloevera etc. take care of that. Using this delivered better results for me when working with large (320x240 - haha) bitmaps like I used in Brixx and Invaderz.

It probably doesn't matter that much for sprites and tiles etc.

I attach my (not very elegant) version of the script so you can see the difference.

12-bit Palette Quantize V2.lua

Edited by AndyMt
  • Like 1

Share this post


Link to post
Share on other sites
I've used this script for a while now, thanks a lot for this. I'm think I stumbled across something in regards to the conversion.
As it's a bit complicated I'll try to explain it:
Colors appear different in emulator:
Recently I noticed that the colors in the emulator appear slightly different than in Aseprite (using your script). Looking at the script it appears it rounds everything to a palette entry ending with "0" for each rgb value:
0x00, 0x10, 0x20, 0x30... 0xE0, 0xFF The emulator produces each entry mostly with the same hex digits for each tuple (using screenshots and Gimp to determine color values). So:
0x00, 0x11, 0x22, 0x33... 0xEE, 0xFF why this can be an issue:
The script currently adds 8 and then discards the lower nibble. I think the thresholds for each of the 16 values per color value needs to be different. Right now there is a big gap in the brighter colors, which leads to color bleeding towards the slightly dimmer ones.
Script algorithm changes:
What I have done now is to change the script slightly and emit the above RGB values, so Gimp, Pro Motion, Aseprite etc. show the right colors (as the emulator would) and also use those for dithering. Of course VERA then can only use the upper 4 bits of each palette entry. Tools like Aloevera etc. take care of that. Using this delivered better results for me when working with large (320x240 - haha) bitmaps like I used in Brixx and Invaderz.
It probably doesn't matter that much for sprites and tiles etc.
I attach my (not very elegant) version of the script so you can see the difference.
12-bit Palette Quantize V2.lua

Yeah I updated the script to use the correct colours some time ago. Not sure why the version you had still discarded the lower nybble.


Sent from my iPhone using Tapatalk
  • Like 1

Share this post


Link to post
Share on other sites
Oh boy - should have checked for updates before I posted .




Sent from my iPhone using Tapatalk

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use